From 243741346e8029be8b17758751287cb6518018df Mon Sep 17 00:00:00 2001 From: timofey Date: Fri, 4 Nov 2022 06:45:53 +0000 Subject: [PATCH] _copy_sync refactor --- ptvp35/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ptvp35/__init__.py b/ptvp35/__init__.py index 7a3d0c0..d736f73 100644 --- a/ptvp35/__init__.py +++ b/ptvp35/__init__.py @@ -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()