mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-28 12:57:52 +00:00
Improve interoperability with threads
This commit is contained in:
parent
1885acd594
commit
fde55a4a7f
@ -58,7 +58,7 @@ def async_to_sync(obj, name):
|
|||||||
loop = asyncio.new_event_loop()
|
loop = asyncio.new_event_loop()
|
||||||
asyncio.set_event_loop(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():
|
if loop.is_running():
|
||||||
return coroutine
|
return coroutine
|
||||||
else:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user