From 618b8a3ceac5a82a867f097de3b4574264ed662b Mon Sep 17 00:00:00 2001 From: timofey Date: Fri, 11 Nov 2022 11:02:10 +0000 Subject: [PATCH] to_thread --- v6d3music/core/cache_url.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/v6d3music/core/cache_url.py b/v6d3music/core/cache_url.py index c1763cf..b05c342 100644 --- a/v6d3music/core/cache_url.py +++ b/v6d3music/core/cache_url.py @@ -36,8 +36,7 @@ async def cache_url(hurl: str, rurl: str, override: bool, tor: bool) -> None: if code: print(f'caching {hurl} failed with {code}') return - loop = asyncio.get_running_loop() - await loop.run_in_executor(None, tmp_path.rename, path) + await asyncio.to_thread(tmp_path.rename, path) await cache_db.set(f'url:{hurl}', str(path)) print('cached', hurl) # await cache_db.set(f'cachable:{hurl}', False)