From 876ec218f86fa7aab05631b4b6ef33c552261c29 Mon Sep 17 00:00:00 2001 From: Alex Velickiy Date: Thu, 31 Aug 2017 17:31:18 +0300 Subject: [PATCH] added restoring running updates thread on reconnection. --- telethon/telegram_client.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/telethon/telegram_client.py b/telethon/telegram_client.py index d75ba28b..63bfa1be 100644 --- a/telethon/telegram_client.py +++ b/telethon/telegram_client.py @@ -133,7 +133,15 @@ class TelegramClient(TelegramBareClient): *args will be ignored. """ - return super().connect() + conn_return = super().connect() + + # Checking if there are update_handlers and if true, start runngin updates thread. + # This situation may occur on reconnecting. + if conn_return and self._update_handlers: + self._set_updates_thread(running=True) + + return conn_return + def disconnect(self): """Disconnects from the Telegram server