Files
reflector/utils/server_utils.py
2023-07-10 14:16:00 +05:30

8 lines
259 B
Python

import asyncio
from functools import partial
def run_in_executor(func, *args, executor=None, **kwargs):
callback = partial(func, *args, **kwargs)
loop = asyncio.get_event_loop()
return asyncio.get_event_loop().run_in_executor(executor, callback)