2
0
mirror of https://github.com/pyrogram/pyrogram synced 2025-08-28 21:07:59 +00:00

Improve interoperability with threads

This commit is contained in:
Dan 2022-04-17 17:36:58 +02:00
parent 1885acd594
commit fde55a4a7f

View File

@ -58,7 +58,7 @@ def async_to_sync(obj, name):
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
if threading.current_thread() is threading.main_thread():
if threading.current_thread() is threading.main_thread() or not main_loop.is_running():
if loop.is_running():
return coroutine
else: