Add some more logs in dialog sync

This commit is contained in:
Tulir Asokan
2022-10-14 16:04:22 +03:00
parent 1b11ec290a
commit 7960f22be9
+4
View File
@@ -731,6 +731,7 @@ class User(DBUser, AbstractUser, BaseUser):
"archived": dialog.archived, "archived": dialog.archived,
} }
if portal.mxid: if portal.mxid:
self.log.debug(f"Backfilling and updating {portal.tgid_log} (dialog sync)")
try: try:
await portal.forward_backfill(self, initial=False, last_tgid=dialog.message.id) await portal.forward_backfill(self, initial=False, last_tgid=dialog.message.id)
except Exception: except Exception:
@@ -740,12 +741,14 @@ class User(DBUser, AbstractUser, BaseUser):
except Exception: except Exception:
self.log.exception(f"Error while updating {portal.tgid_log}") self.log.exception(f"Error while updating {portal.tgid_log}")
elif should_create: elif should_create:
self.log.debug(f"Creating portal for {portal.tgid_log} immediately (dialog sync)")
try: try:
await portal.create_matrix_room(self, dialog.entity, invites=[self.mxid]) await portal.create_matrix_room(self, dialog.entity, invites=[self.mxid])
was_created = True was_created = True
except Exception: except Exception:
self.log.exception(f"Error while creating {portal.tgid_log}") self.log.exception(f"Error while creating {portal.tgid_log}")
elif self.config["bridge.sync_deferred_create_all"]: elif self.config["bridge.sync_deferred_create_all"]:
self.log.debug(f"Enqueuing deferred dialog sync for {portal.tgid_log}")
await portal.enqueue_backfill( await portal.enqueue_backfill(
self, self,
priority=40, priority=40,
@@ -759,6 +762,7 @@ class User(DBUser, AbstractUser, BaseUser):
was_created=was_created, was_created=was_created,
**post_sync_args, **post_sync_args,
) )
self.log.debug(f"_sync_dialog finished for {portal.tgid_log}")
async def _post_sync_dialog( async def _post_sync_dialog(
self, self,