mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-10 19:46:36 +03:00
Expect BufferError during automatic reconnect
This seems to occur whe the Telegram servers are dying and logging everyone out.
This commit is contained in:
parent
20606b3a71
commit
185a93a105
|
@ -369,6 +369,16 @@ class MTProtoSender:
|
|||
self._log.info('Failed reconnection attempt %d with %s',
|
||||
attempt, e.__class__.__name__)
|
||||
await asyncio.sleep(self._delay)
|
||||
except BufferError as e:
|
||||
# TODO there should probably only be one place to except all these errors
|
||||
if isinstance(e, InvalidBufferError) and e.code == 404:
|
||||
self._log.info('Broken authorization key; resetting')
|
||||
else:
|
||||
self._log.warning('Invalid buffer %s', e)
|
||||
|
||||
self.auth_key.key = None
|
||||
if self._auth_key_callback:
|
||||
self._auth_key_callback(None)
|
||||
except Exception as e:
|
||||
last_error = e
|
||||
self._log.exception('Unexpected exception reconnecting on '
|
||||
|
|
Loading…
Reference in New Issue
Block a user