mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2025-12-29 12:04:51 +00:00
pyrofork: Adapt uvloop changes
Signed-off-by: wulan17 <wulan17@komodos.id>
This commit is contained in:
parent
77f50c6a82
commit
d35abe89c4
2 changed files with 11 additions and 2 deletions
|
|
@ -95,7 +95,12 @@ class Dispatcher:
|
|||
|
||||
def __init__(self, client: "pyrogram.Client"):
|
||||
self.client = client
|
||||
self.loop = asyncio.get_event_loop()
|
||||
try:
|
||||
loop = asyncio.get_event_loop()
|
||||
except RuntimeError:
|
||||
loop = asyncio.new_event_loop()
|
||||
asyncio.set_event_loop(loop)
|
||||
self.loop = loop
|
||||
|
||||
self.handler_worker_tasks = []
|
||||
self.locks_list = []
|
||||
|
|
|
|||
|
|
@ -29,7 +29,11 @@ from pyrogram.methods.utilities import idle as idle_module, compose as compose_m
|
|||
|
||||
def async_to_sync(obj, name):
|
||||
function = getattr(obj, name)
|
||||
try:
|
||||
main_loop = asyncio.get_event_loop()
|
||||
except RuntimeError:
|
||||
main_loop = asyncio.new_event_loop()
|
||||
asyncio.set_event_loop(main_loop)
|
||||
|
||||
def async_to_sync_gen(agen, loop, is_main_thread):
|
||||
async def anext(agen):
|
||||
|
|
|
|||
Loading…
Reference in a new issue