node-docker-watchdog
v1.2.3
Published
Simple watchdog. For node&docker friendship forever. No more stalled loop.
Downloads
17
Readme
node-docker-watchdog
Simple watchdog. For node&docker friendship forever. No more stalled loop.
Healthcheck script
const watchdog = require("node-docker-watchdog");
watchdog.CliWatchdogHealthcheck({
project: "wise-hub",
environment: "production",
});
Watchdog in looping server:
import { DockerWatchdogServer, TimeWatchdogStrategy } from "node-docker-watchdog";
const timeWatchdogA = new TimeWatchdogStrategy().setIdentitier("timeWatchdogA");
const timeWatchdogB = new TimeWatchdogStrategy().setIdentitier("timeWatchdogB");
const watchdogServer = new DockerWatchdogServer([timeWatchdogA, timeWatchdogB]);
(async () => {
await watchdogServer.listen();
recurrentLoopFn();
})();
function recurrentLoopFn() {
console.log("beat 20000ms");
timeWatchdogA.beat(14000);
timeWatchdogB.beat(8000);
setTimeout(() => recurrentLoopFn(), 20000);
}