From 077ac8efa5253745c78b1a53048915968aef1ea8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn-Michael=20Miehe?= <40151420+ldericher@users.noreply.github.com> Date: Mon, 5 Sep 2022 13:02:15 +0000 Subject: [PATCH] correction using link --- api/ovdashboard_api/async_helpers.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/api/ovdashboard_api/async_helpers.py b/api/ovdashboard_api/async_helpers.py index a1de3dc..ddc8919 100644 --- a/api/ovdashboard_api/async_helpers.py +++ b/api/ovdashboard_api/async_helpers.py @@ -13,17 +13,18 @@ def run_in_executor(f): """ Decorator to make blocking a function call asyncio compatible. https://stackoverflow.com/questions/41063331/how-to-use-asyncio-with-existing-blocking-library/ + https://stackoverflow.com/a/53719009 """ @wraps(f) - def inner(*args, **kwargs): + async def wrapper(*args, **kwargs): loop = get_running_loop() - return loop.run_in_executor( + return await loop.run_in_executor( None, partial(f, *args, **kwargs), ) - return inner + return wrapper def get_ttl_hash(seconds: int = 20) -> int: