mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-06-23 21:46:49 +00: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',
|
self._log.info('Failed reconnection attempt %d with %s',
|
||||||
attempt, e.__class__.__name__)
|
attempt, e.__class__.__name__)
|
||||||
await asyncio.sleep(self._delay)
|
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:
|
except Exception as e:
|
||||||
last_error = e
|
last_error = e
|
||||||
self._log.exception('Unexpected exception reconnecting on '
|
self._log.exception('Unexpected exception reconnecting on '
|
||||||
|
Loading…
Reference in New Issue
Block a user