refactor copy

This commit is contained in:
AF 2022-11-04 06:40:25 +00:00 committed by parrrate
parent 8ce687a419
commit 3c2c45e05e
Signed by: alisa
SSH Key Fingerprint: SHA256:vNY4pdIZvO1FYJKHROkdHLtvyopizvZVAEwg9AF6h04

View File

@ -225,9 +225,12 @@ class DbConnection:
while True: while True:
await self._background_cycle() await self._background_cycle()
async def _finish_recovery(self): async def _copy(self):
with concurrent.futures.ThreadPoolExecutor() as pool: with concurrent.futures.ThreadPoolExecutor() as pool:
await self.__loop.run_in_executor(pool, shutil.copy, self.__path_backup, self.__path) await self.__loop.run_in_executor(pool, shutil.copyfile, self.__path_backup, self.__path)
async def _finish_recovery(self):
await self._copy()
self.__path_recover.unlink() self.__path_recover.unlink()
self.__path_backup.unlink() self.__path_backup.unlink()