tt-help-cli-ycl 1.4.87 → 1.4.88
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/package.json +1 -1
- package/src/clash/daemon.js +11 -4
- package/src/watchdog/agent.js +6 -3
package/package.json
CHANGED
package/src/clash/daemon.js
CHANGED
|
@@ -66,10 +66,16 @@ export class ClashDaemon {
|
|
|
66
66
|
? `API 端口 ${checker.CONFIG.apiPort} 可达`
|
|
67
67
|
: `Clash 控制端口 ${checker.CONFIG.apiPort} 未开启`;
|
|
68
68
|
if (!alive) {
|
|
69
|
-
this.
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
)
|
|
69
|
+
this._waitRetry = (this._waitRetry || 0) + 1;
|
|
70
|
+
// 前 3 次(约 30s)每次打印,之后每 6 次(约 1 分钟)打印一次,避免刷屏
|
|
71
|
+
const shouldLog = this._waitRetry <= 3 || this._waitRetry % 6 === 0;
|
|
72
|
+
if (shouldLog) {
|
|
73
|
+
const waitedSec = this._waitRetry * 10;
|
|
74
|
+
this._log(`⚠ Clash 未就绪:${reason}(已等待 ${waitedSec}s)`);
|
|
75
|
+
this._log(
|
|
76
|
+
` 等待 API 端口 ${checker.CONFIG.apiPort} 可用,10s 后重试(Clash 就绪后自动接入)...`,
|
|
77
|
+
);
|
|
78
|
+
}
|
|
73
79
|
ipc.writeHealth({
|
|
74
80
|
node: "?",
|
|
75
81
|
healthy: false,
|
|
@@ -80,6 +86,7 @@ export class ClashDaemon {
|
|
|
80
86
|
this._waitTimer = setTimeout(() => this.start(), 10_000);
|
|
81
87
|
return;
|
|
82
88
|
}
|
|
89
|
+
this._waitRetry = 0; // 就绪后重置等待计数
|
|
83
90
|
// 等待期间的重试定时器已触发,清理引用
|
|
84
91
|
if (this._waitTimer) {
|
|
85
92
|
this._waitTimer = null;
|
package/src/watchdog/agent.js
CHANGED
|
@@ -499,10 +499,13 @@ export class WatchdogAgent {
|
|
|
499
499
|
console.error(`[watchdog] 宽限期结束,恢复正常心跳失败计数`);
|
|
500
500
|
}
|
|
501
501
|
|
|
502
|
+
// 看门狗作为最外层守护进程:即使服务端长时间不可达也保持运行、持续重试。
|
|
503
|
+
// 达到阈值仅提示一次并重置计数(业务进程仍由 ProcessManager 守护,服务端恢复后自动续上)
|
|
502
504
|
if (this.consecutiveFailures >= this.maxFailures) {
|
|
503
|
-
console.error(
|
|
504
|
-
|
|
505
|
-
|
|
505
|
+
console.error(
|
|
506
|
+
`[watchdog] 已连续 ${this.consecutiveFailures} 次心跳失败(服务端可能不可达),保持运行并持续重试(每 ${Math.round(this.intervalMs / 1000)}s)`,
|
|
507
|
+
);
|
|
508
|
+
this.consecutiveFailures = 0;
|
|
506
509
|
}
|
|
507
510
|
}
|
|
508
511
|
}
|