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
This commit is contained in:
parent
769575c885
commit
dbd5b173c1
|
|
@ -66,10 +66,11 @@ let syncStale = false;
|
||||||
|
|
||||||
if (notionSync) {
|
if (notionSync) {
|
||||||
const lastSync = new Date(notionSync.last_sync_time);
|
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);
|
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;
|
syncStale = hoursSinceSync > 24;
|
||||||
|
|
||||||
// 强制检查清单 (§四)
|
// 强制检查清单 (§四)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue