From 11a1e40f0d2c4511ce9d7d001f1811473d1a39e8 Mon Sep 17 00:00:00 2001 From: digua Date: Wed, 22 Apr 2026 21:10:47 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20Pull=20=E5=A2=9E=E9=87=8F=E5=90=8C?= =?UTF-8?q?=E6=AD=A5=E5=A2=9E=E5=8A=A0=2060=20=E7=A7=92=E9=87=8D=E5=8F=A0?= =?UTF-8?q?=E7=AA=97=E5=8F=A3=E9=81=BF=E5=85=8D=E6=B6=88=E6=81=AF=E4=B8=A2?= =?UTF-8?q?=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit lastPullAt 原先直接使用 Date.now(),在时钟偏差或迟到消息场景下 可能导致消息被跳过。现在减去 60 秒重叠窗口,依靠去重机制吸收 重复数据,确保不丢消息。 Made-with: Cursor --- electron/main/api/pullScheduler.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/electron/main/api/pullScheduler.ts b/electron/main/api/pullScheduler.ts index 901a7a49..9af10586 100644 --- a/electron/main/api/pullScheduler.ts +++ b/electron/main/api/pullScheduler.ts @@ -234,6 +234,7 @@ async function importTempFile(baseUrl: string, sess: ImportSession, tempFile: st const MAX_PAGES_PER_PULL = 50 const DEFAULT_PULL_LIMIT = 1000 +const PULL_OVERLAP_SECONDS = 60 interface PullSessionResult { success: boolean @@ -337,7 +338,7 @@ async function executePullSession(sourceId: string, ds: DataSource, sess: Import } updateImportSession(sourceId, sess.id, { - lastPullAt: Math.floor(Date.now() / 1000), + lastPullAt: Math.floor(Date.now() / 1000) - PULL_OVERLAP_SECONDS, lastStatus: 'success', lastNewMessages: totalNewMessages, lastError: '',