From 1bba6902d063083c8d9a790748ab1f60f771a2fb Mon Sep 17 00:00:00 2001 From: timofey Date: Fri, 4 Nov 2022 06:40:25 +0000 Subject: [PATCH] refactor copy --- ptvp35/__init__.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ptvp35/__init__.py b/ptvp35/__init__.py index 767ab41..7a3d0c0 100644 --- a/ptvp35/__init__.py +++ b/ptvp35/__init__.py @@ -225,9 +225,12 @@ class DbConnection: while True: await self._background_cycle() - async def _finish_recovery(self): + async def _copy(self): 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_backup.unlink()