Do not cancel UpdatesThread .receive() on reconnection

This commit is contained in:
Lonami Exo 2017-06-10 13:16:37 +02:00
parent a73be04da7
commit 5c138977c3

View File

@ -785,7 +785,10 @@ class TelegramClient(TelegramBareClient):
try: try:
self._updates_thread_receiving.set() self._updates_thread_receiving.set()
self._logger.debug('Trying to receive updates from the updates thread') self._logger.debug('Trying to receive updates from the updates thread')
result = self.sender.receive_update(timeout=timeout) result = self.sender.receive_update(timeout=timeout)
self._updates_thread_receiving.clear()
self._logger.info('Received update from the updates thread') self._logger.info('Received update from the updates thread')
for handler in self._update_handlers: for handler in self._update_handlers:
handler(result) handler(result)
@ -812,7 +815,6 @@ class TelegramClient(TelegramBareClient):
raise raise
self._logger.debug('Updates thread released the lock') self._logger.debug('Updates thread released the lock')
self._updates_thread_receiving.clear()
# Thread is over, so clean unset its variable # Thread is over, so clean unset its variable
self._updates_thread = None self._updates_thread = None