From 508071556579ec1beb51e23b1ccfba13c87ed924 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Thu, 15 Dec 2022 21:21:58 +0100 Subject: [PATCH] Change updates add_done_callback to discard tasks more reliably See #3235. This should help tone down memory usage a little. --- telethon/client/updates.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/telethon/client/updates.py b/telethon/client/updates.py index 5d437e81..af6a6bfb 100644 --- a/telethon/client/updates.py +++ b/telethon/client/updates.py @@ -271,7 +271,7 @@ class UpdateMethods: # 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