dsh-qianchuan-toolkit 1.0.12 → 1.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# 更新日志
|
|
2
2
|
|
|
3
|
+
## 1.0.13
|
|
4
|
+
|
|
5
|
+
- **再修看门狗误报(整点播报导致的)**:心跳里的 `nextAt` 可能是「醒来发整点播报」的时刻(00:00),发完播报后进程继续睡到 00:15,但心跳没更新 → 看门狗在 00:03 判 `heartbeat-stale` 误报。两处修:① 看门狗改为**优先看 `nextRound`**(真正的下一轮时间),只有没有 `nextRound` 时才退回 `nextAt`;② `hourly.mjs` 发完整点播报后立即重写心跳(`nextAt = nextRound = 下一轮`)。
|
|
6
|
+
- 验证:`{"ok":true}`;模拟 `nextRound` 已过 → 正常报 `heartbeat-stale`。
|
|
7
|
+
|
|
3
8
|
## 1.0.12
|
|
4
9
|
|
|
5
10
|
- **修看门狗误报(关键)**:原判据「心跳超过 6 分钟没更新 = 卡死」在正常节奏下必然误报 —— 巡航两轮之间最长 15 分钟(节点 :15/:30/:45/:55),每两轮之间都会报一次「🚨 巡航可能卡住」。现改为**只看心跳里自己写的下一轮时间**:`now > nextAt + 宽限`(默认 3 分钟,`--grace-min` 可调)才判卡死;没有 `nextAt` 时才退回按 `--stale-min` 判。告警文案也改成「已过下一轮时间 N 分钟仍未出现新心跳」。
|
|
@@ -755,6 +755,8 @@ try {
|
|
|
755
755
|
log('整点播报:等到 ' + new Date(due).toLocaleString('zh-CN'))
|
|
756
756
|
await sleep(Math.max(0, due - Date.now()))
|
|
757
757
|
await flushDueDigests()
|
|
758
|
+
// 播报发完后把心跳改回「下一轮」时间,避免看门狗把这次醒来误判成卡死
|
|
759
|
+
if (next) writeHeartbeat({ round: i, ms: Date.now() - roundStart, nextAt: next, nextRound: next })
|
|
758
760
|
}
|
|
759
761
|
}
|
|
760
762
|
if (last) break
|
|
@@ -106,7 +106,8 @@ async function check() {
|
|
|
106
106
|
// 只有「已经过了它自己说的下一轮时间 + 宽限」才算卡死。
|
|
107
107
|
const hbMs = new Date(hb.ts).getTime()
|
|
108
108
|
const age = now - hbMs
|
|
109
|
-
|
|
109
|
+
// 优先用 nextRound(真正的下一轮);nextAt 可能只是「醒来发整点播报」的时刻,会正常过期
|
|
110
|
+
const dueAt = Number(hb.nextRound || 0) || Number(hb.nextAt || 0) || 0
|
|
110
111
|
const overdue = dueAt ? now > dueAt + GRACE_MS : age > STALE_MS
|
|
111
112
|
if (overdue) issues.push({ kind: 'heartbeat-stale', msg: (dueAt ? '已过下一轮时间 ' + Math.round((now - dueAt) / 60000) + ' 分钟仍未出现新心跳' : '心跳停止 ' + Math.round(age / 60000) + ' 分钟') + '(最后 ' + new Date(hb.ts).toLocaleString('zh-CN') + ',第 ' + (hb.round || '?') + ' 轮' + (dueAt ? ',应于 ' + new Date(dueAt).toLocaleString('zh-CN') + ' 有新心跳' : '') + ')' })
|
|
112
113
|
}
|