@holin-work/holin-cli 1.3.1 → 1.3.2
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/bin/holin-cli.js +19 -10
- package/package.json +1 -1
package/bin/holin-cli.js
CHANGED
|
@@ -511,6 +511,7 @@ function cmdProxyStart() {
|
|
|
511
511
|
});
|
|
512
512
|
|
|
513
513
|
// Health check: idle timeout + credentials file monitoring
|
|
514
|
+
let credsMissingSince = null;
|
|
514
515
|
const healthCheck = setInterval(() => {
|
|
515
516
|
const idleMs = Date.now() - lastRequestTime;
|
|
516
517
|
if (idleMs > IDLE_TIMEOUT_MS) {
|
|
@@ -519,16 +520,24 @@ function cmdProxyStart() {
|
|
|
519
520
|
return;
|
|
520
521
|
}
|
|
521
522
|
// Check if credentials file still exists (user may have logged out / uninstalled)
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
523
|
+
// Use a 30s grace period to avoid false positives during re-auth (old creds cleared, new ones not yet written)
|
|
524
|
+
const credsExist = existsSync(CREDENTIALS_FILE);
|
|
525
|
+
const creds = credsExist ? readCredentials() : null;
|
|
526
|
+
const hasValidKey = !!(creds?.api_key);
|
|
527
|
+
if (!hasValidKey) {
|
|
528
|
+
if (!credsMissingSince) {
|
|
529
|
+
credsMissingSince = Date.now();
|
|
530
|
+
log("[proxy] Credentials missing, starting 30s grace period...");
|
|
531
|
+
} else if (Date.now() - credsMissingSince > 30000) {
|
|
532
|
+
log("[proxy] Credentials missing for 30s, auto-exiting.");
|
|
533
|
+
cleanupAndExit();
|
|
534
|
+
return;
|
|
535
|
+
}
|
|
536
|
+
} else {
|
|
537
|
+
if (credsMissingSince) {
|
|
538
|
+
log("[proxy] Credentials restored, canceling grace period.");
|
|
539
|
+
credsMissingSince = null;
|
|
540
|
+
}
|
|
532
541
|
}
|
|
533
542
|
}, HEALTH_CHECK_INTERVAL_MS);
|
|
534
543
|
|