فهرست منبع

Start MQTT connection immediately after getting sequence ID

Tulir Asokan 3 سال پیش
والد
کامیت
3478fb851e
1فایلهای تغییر یافته به همراه4 افزوده شده و 3 حذف شده
  1. 4 3
      mautrix_instagram/user.py

+ 4 - 3
mautrix_instagram/user.py

@@ -335,6 +335,10 @@ class User(DBUser, BaseUser):
 
     async def sync(self) -> None:
         resp = await self.client.get_inbox()
+
+        if not self._listen_task:
+            await self.start_listen(resp.seq_id, resp.snapshot_at_ms)
+
         max_age = self.config["bridge.portal_create_max_age"] * 1_000_000
         limit = self.config["bridge.chat_sync_limit"]
         min_active_at = (time.time() * 1_000_000) - max_age
@@ -353,9 +357,6 @@ class User(DBUser, BaseUser):
         except Exception:
             self.log.exception("Error updating direct chat list")
 
-        if not self._listen_task:
-            await self.start_listen(resp.seq_id, resp.snapshot_at_ms)
-
     async def start_listen(
         self, seq_id: int | None = None, snapshot_at_ms: int | None = None
     ) -> None: