From 5c138977c35add3e73620442f3889c531f70394e Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Sat, 10 Jun 2017 13:16:37 +0200 Subject: [PATCH] Do not cancel UpdatesThread .receive() on reconnection --- telethon/telegram_client.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/telethon/telegram_client.py b/telethon/telegram_client.py index 7bc72eac..ef93901b 100644 --- a/telethon/telegram_client.py +++ b/telethon/telegram_client.py @@ -785,7 +785,10 @@ class TelegramClient(TelegramBareClient): try: self._updates_thread_receiving.set() self._logger.debug('Trying to receive updates from the updates thread') + result = self.sender.receive_update(timeout=timeout) + + self._updates_thread_receiving.clear() self._logger.info('Received update from the updates thread') for handler in self._update_handlers: handler(result) @@ -812,7 +815,6 @@ class TelegramClient(TelegramBareClient): raise self._logger.debug('Updates thread released the lock') - self._updates_thread_receiving.clear() # Thread is over, so clean unset its variable self._updates_thread = None