浏览代码

backfill: fix thread sync happening too quickly delay

Signed-off-by: Sumner Evans <sumner@beeper.com>
Sumner Evans 2 年之前
父节点
当前提交
b1c361e4b0
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      mautrix_instagram/user.py

+ 2 - 2
mautrix_instagram/user.py

@@ -760,12 +760,12 @@ class User(DBUser, BaseUser):
         async for thread, seq_id, cursor in threads:
             found_thread_count += 1
             now = time.monotonic()
-            if last_thread_sync_ts is not None and now < last_thread_sync_ts + sync_delay:
+            if now < last_thread_sync_ts + sync_delay:
                 delay = last_thread_sync_ts + sync_delay - now
                 self.log.debug("Thread sync is happening too quickly. Waiting for %ds", delay)
                 await asyncio.sleep(delay)
 
-            last_thread_sync_ts = now
+            last_thread_sync_ts = time.monotonic()
             had_new_messages = await self._sync_thread(thread)
             if not had_new_messages and stop_when_threads_have_no_messages_to_backfill:
                 self.log.debug("Got to threads with no new messages. Stopping sync.")