Skip to content

Commit

Permalink
Don't crash bridge if startup of one user fails. Fixes #292
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Sep 2, 2019
1 parent 43b3cc2 commit df67ed5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion mautrix_telegram/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,12 @@ def from_db(cls, db_user: DBUser) -> 'User':
# endregion
# region Telegram connection management

async def try_ensure_started(self) -> None:
try:
await self.ensure_started()
except Exception:
self.log.exception("Exception in ensure_started")

async def ensure_started(self, even_if_no_session=False) -> 'User':
if not self.puppet_whitelisted or self.connected:
return self
Expand Down Expand Up @@ -432,5 +438,5 @@ def init(context: 'Context') -> Iterable[Awaitable['User']]:
global config
config = context.config

return (User.from_db(db_user).ensure_started()
return (User.from_db(db_user).try_ensure_started()
for db_user in DBUser.all_with_tgid())

0 comments on commit df67ed5

Please sign in to comment.