fix(#4): re-enable connection watchdog with env-flag opt-out
Some checks failed
Docker image / build-and-push-image (push) Has been cancelled

Calls `relayConnectionWatchdog` (introduced in the previous commit) at
the end of admin-interface connect(). Gated by NSEC_BUNKER_DISABLE_WATCHDOG=1
for operators who run external liveness checks (Prometheus probes, k8s
readiness, etc.) and don't want the daemon to self-terminate.

This restores the watchdog behavior that was commented out in commit
42dbbd7 (the emergency stopgap for the old self-echo false positives),
but on top of the now-reliable pool-status mechanism.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Padreug 2026-05-27 20:43:12 +02:00
commit fb1c239e15

View file

@ -168,12 +168,17 @@ class AdminInterface {
this.handleRequest(req); this.handleRequest(req);
}); });
// pingOrDie disabled — NDK 2.8.1 outbox model doesn't echo // Connection watchdog: exit if pool reports no connected relays
// self-published events back through subscriptions on // for >60s so the process supervisor (systemd / docker restart
// non-public relay channels, so the watchdog fires false // policy / k8s) can recover. Replaces the original self-echo
// positives and exits the bunker every 50s on private relays. // pingOrDie — see relayConnectionWatchdog comment + #4 + #7.
// See aiolabs/nsecbunkerd#4 + #7. // Operators with external liveness checking can disable via
// pingOrDie(this.ndk); // NSEC_BUNKER_DISABLE_WATCHDOG=1.
if (process.env.NSEC_BUNKER_DISABLE_WATCHDOG !== '1') {
relayConnectionWatchdog(this.ndk);
} else {
console.log('⏸ watchdog disabled via NSEC_BUNKER_DISABLE_WATCHDOG=1');
}
}).catch((err) => { }).catch((err) => {
console.log('❌ admin connection failed'); console.log('❌ admin connection failed');
console.log(err); console.log(err);