Fix some errors
This commit is contained in:
@@ -346,7 +346,10 @@ class Portal:
|
|||||||
await self.invite_to_matrix(invites or [])
|
await self.invite_to_matrix(invites or [])
|
||||||
return self.mxid
|
return self.mxid
|
||||||
async with self._room_create_lock:
|
async with self._room_create_lock:
|
||||||
return await self._create_matrix_room(user, entity, invites)
|
try:
|
||||||
|
return await self._create_matrix_room(user, entity, invites)
|
||||||
|
except Exception:
|
||||||
|
self.log.exception("Fatal error creating Matrix room")
|
||||||
|
|
||||||
async def _create_matrix_room(self, user: 'AbstractUser', entity: TypeChat, invites: InviteList
|
async def _create_matrix_room(self, user: 'AbstractUser', entity: TypeChat, invites: InviteList
|
||||||
) -> Optional[MatrixRoomID]:
|
) -> Optional[MatrixRoomID]:
|
||||||
|
|||||||
@@ -161,6 +161,12 @@ class User(AbstractUser):
|
|||||||
# endregion
|
# endregion
|
||||||
# region Telegram connection management
|
# 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")
|
||||||
|
|
||||||
def ensure_started(self, even_if_no_session=False) -> Awaitable['User']:
|
def ensure_started(self, even_if_no_session=False) -> Awaitable['User']:
|
||||||
return super().ensure_started(even_if_no_session)
|
return super().ensure_started(even_if_no_session)
|
||||||
|
|
||||||
@@ -400,9 +406,9 @@ class User(AbstractUser):
|
|||||||
# endregion
|
# endregion
|
||||||
|
|
||||||
|
|
||||||
def init(context: 'Context') -> List[Awaitable['User']]:
|
def init(context: 'Context') -> List[Awaitable[None]]:
|
||||||
global config
|
global config
|
||||||
config = context.config
|
config = context.config
|
||||||
|
|
||||||
users = [User.from_db(user) for user in DBUser.all()]
|
users = [User.from_db(user) for user in DBUser.all()]
|
||||||
return [user.ensure_started() for user in users if user.tgid]
|
return [user.try_ensure_started() for user in users if user.tgid]
|
||||||
|
|||||||
Reference in New Issue
Block a user