Stop storing asyncio loop in TelegramClient

The loop parameter was ignored because it shouldn't be used, but
the fact it still stored the current loop on creation messes up
with asyncio.run.
This commit is contained in:
Lonami Exo
2021-01-18 22:43:39 +01:00
parent 3ddb0a3903
commit de7cf03ba7
2 changed files with 8 additions and 9 deletions

View File

@@ -309,14 +309,14 @@ class UpdateMethods:
channel_id = self._state_cache.get_channel_id(update)
args = (update, others, channel_id, self._state_cache[channel_id])
if self._dispatching_updates_queue is None:
task = self._loop.create_task(self._dispatch_update(*args))
task = self.loop.create_task(self._dispatch_update(*args))
self._updates_queue.add(task)
task.add_done_callback(lambda _: self._updates_queue.discard(task))
else:
self._updates_queue.put_nowait(args)
if not self._dispatching_updates_queue.is_set():
self._dispatching_updates_queue.set()
self._loop.create_task(self._dispatch_queue_updates())
self.loop.create_task(self._dispatch_queue_updates())
self._state_cache.update(update)