mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-07 13:34:59 +03:00
Await for update handler to finish in executor
This commit is contained in:
parent
1285f11405
commit
ffa0d31ac7
|
@ -111,8 +111,9 @@ def enable(loop=None, executor=None, max_workers=1):
|
||||||
|
|
||||||
@functools.wraps(old_add_event_handler)
|
@functools.wraps(old_add_event_handler)
|
||||||
def add_proxied_event_handler(self, callback, *args, **kwargs):
|
def add_proxied_event_handler(self, callback, *args, **kwargs):
|
||||||
def _proxy(*pargs, **pkwargs):
|
async def _proxy(*pargs, **pkwargs):
|
||||||
executor.submit(callback, *pargs, **pkwargs)
|
await loop.run_in_executor(
|
||||||
|
executor, functools.partial(callback, *pargs, **pkwargs))
|
||||||
|
|
||||||
proxied_event_handlers[callback] = _proxy
|
proxied_event_handlers[callback] = _proxy
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user