Skip to content

Bridge should wait on startup if a flood error is reported #836

@Half-Shot

Description

@Half-Shot

During startup after presumably having issues with the bridge: Telethon raised an exception about needing to wait before the client could sign in.

Rather than waiting for the flood time, the bridge simply exited and restarted leading to a longer required wait time.

The bridge should probably just wait out the required time reported in FloodWaitError and then try to start, rather than crashlooping and making the problem worse.

[2022-09-12 13:18:47,894] [CRITICAL@mau.init] Unexpected error in main event loop
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/mautrix/util/program.py", line 219, in _run
    self.loop.run_until_complete(self.start())
  File "/usr/lib/python3.9/asyncio/base_events.py", line 647, in run_until_complete
    return future.result()
  File "/usr/lib/python3.9/site-packages/mautrix_telegram/__main__.py", line 133, in start
    await super().start()
  File "/usr/lib/python3.9/site-packages/mautrix/bridge/bridge.py", line 228, in start
    await super().start()
  File "/usr/lib/python3.9/site-packages/mautrix/util/program.py", line 253, in start
    await asyncio.gather(*(self.startup_actions or []))
  File "/usr/lib/python3.9/site-packages/mautrix_telegram/bot.py", line 105, in start
    await self.client.sign_in(bot_token=self.token)
  File "/usr/lib/python3.9/site-packages/telethon/client/auth.py", line 368, in sign_in
    result = await self(request)
  File "/usr/lib/python3.9/site-packages/telethon/client/users.py", line 30, in __call__
    return await self._call(self._sender, request, ordered=ordered)
  File "/usr/lib/python3.9/site-packages/telethon/client/users.py", line 84, in _call
    result = await future
telethon.errors.rpcerrorlist.FloodWaitError: A wait of 20813 seconds is required (caused by ImportBotAuthorizationRequest)
CONTEXT=

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions