Retry client connection more times on startup

This commit is contained in:
Tulir Asokan 2021-04-03 15:39:50 +03:00
parent 60d163f6c5
commit a078bdd120

View File

@ -141,13 +141,13 @@ class Client:
self.log.error(f"Invalid token: {e}. Disabling client") self.log.error(f"Invalid token: {e}. Disabling client")
self.db_instance.enabled = False self.db_instance.enabled = False
return return
except MatrixRequestError: except Exception as e:
if try_n >= 5: if try_n >= 8:
self.log.exception("Failed to get /account/whoami, disabling client") self.log.exception("Failed to get /account/whoami, disabling client")
self.db_instance.enabled = False self.db_instance.enabled = False
else: else:
self.log.exception(f"Failed to get /account/whoami, " self.log.warning(f"Failed to get /account/whoami, "
f"retrying in {(try_n + 1) * 10}s") f"retrying in {(try_n + 1) * 10}s: {e}")
_ = asyncio.ensure_future(self.start(try_n + 1), loop=self.loop) _ = asyncio.ensure_future(self.start(try_n + 1), loop=self.loop)
return return
if user_id != self.id: if user_id != self.id: