Skip to content

Commit

Permalink
Change updates add_done_callback to discard tasks more reliably
Browse files Browse the repository at this point in the history
See #3235. This should help tone down memory usage a little.
  • Loading branch information
Lonami committed Dec 16, 2022
1 parent b2925f8 commit 5080715
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion telethon/client/updates.py
Expand Up @@ -271,7 +271,7 @@ async def _update_loop(self: 'TelegramClient'):
# TODO if _dispatch_update fails for whatever reason, it's not logged! this should be fixed
task = self.loop.create_task(self._dispatch_update(updates_to_dispatch.popleft()))
self._event_handler_tasks.add(task)
task.add_done_callback(lambda _: self._event_handler_tasks.discard(task))
task.add_done_callback(self._event_handler_tasks.discard)

continue

Expand Down

0 comments on commit 5080715

Please sign in to comment.