_copy_sync refactor
This commit is contained in:
		
							parent
							
								
									1bba6902d0
								
							
						
					
					
						commit
						243741346e
					
				@ -225,9 +225,12 @@ class DbConnection:
 | 
			
		||||
        while True:
 | 
			
		||||
            await self._background_cycle()
 | 
			
		||||
 | 
			
		||||
    def _copy_sync(self):
 | 
			
		||||
        shutil.copyfile(self.__path_backup, self.__path)
 | 
			
		||||
 | 
			
		||||
    async def _copy(self):
 | 
			
		||||
        with concurrent.futures.ThreadPoolExecutor() as pool:
 | 
			
		||||
            await self.__loop.run_in_executor(pool, shutil.copyfile, self.__path_backup, self.__path)
 | 
			
		||||
            await self.__loop.run_in_executor(pool, self._copy_sync)
 | 
			
		||||
 | 
			
		||||
    async def _finish_recovery(self):
 | 
			
		||||
        await self._copy()
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user