From 633e11531a882d0cd9cafdf437f9e99e43a21271 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Sun, 23 Jun 2019 13:56:12 +0200 Subject: [PATCH] Fix coroutine scheduling when adding/removing handlers --- pyrogram/client/ext/dispatcher.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyrogram/client/ext/dispatcher.py b/pyrogram/client/ext/dispatcher.py index c2c35569..167e9d67 100644 --- a/pyrogram/client/ext/dispatcher.py +++ b/pyrogram/client/ext/dispatcher.py @@ -130,7 +130,7 @@ class Dispatcher: for lock in self.locks_list: lock.release() - asyncio.get_event_loop().run_until_complete(fn()) + asyncio.get_event_loop().create_task(fn()) def remove_handler(self, handler, group: int): async def fn(): @@ -146,7 +146,7 @@ class Dispatcher: for lock in self.locks_list: lock.release() - asyncio.get_event_loop().run_until_complete(fn()) + asyncio.get_event_loop().create_task(fn()) async def update_worker(self, lock): while True: