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: