From dbd5b173c1a24926701cf5c035cc9c8011e0ff42 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 25 Mar 2026 23:55:16 +0000 Subject: [PATCH] fix: deduplicate isNaN check in wakeup sync validation Co-authored-by: qinfendebingshuo <207279273+qinfendebingshuo@users.noreply.github.com> Agent-Logs-Url: https://github.com/qinfendebingshuo/guanghulab/sessions/75b1b671-d7ed-465c-95e7-d04ac4ebb8ba --- scripts/zhuyuan-wakeup.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/zhuyuan-wakeup.js b/scripts/zhuyuan-wakeup.js index 74ff2712..e14cf86d 100644 --- a/scripts/zhuyuan-wakeup.js +++ b/scripts/zhuyuan-wakeup.js @@ -66,10 +66,11 @@ let syncStale = false; if (notionSync) { const lastSync = new Date(notionSync.last_sync_time); - if (isNaN(lastSync.getTime())) { + const validSyncTime = !isNaN(lastSync.getTime()); + if (!validSyncTime) { console.error('⚠️ notion_sync.last_sync_time 格式无效:', notionSync.last_sync_time); } - const hoursSinceSync = isNaN(lastSync.getTime()) ? Infinity : (Date.now() - lastSync.getTime()) / (1000 * 60 * 60); + const hoursSinceSync = validSyncTime ? (Date.now() - lastSync.getTime()) / (1000 * 60 * 60) : Infinity; syncStale = hoursSinceSync > 24; // 强制检查清单 (§四)