Run signed health as a sequential daemon loop
This commit is contained in:
parent
c94c498ec7
commit
2a905354b9
1 changed files with 10 additions and 5 deletions
15
src/index.ts
15
src/index.ts
|
|
@ -22,11 +22,7 @@ try {
|
|||
console.error("Heimdall verse publication failed on interval:", error);
|
||||
});
|
||||
}, versePulseIntervalMs);
|
||||
const healthTimer = setInterval(() => {
|
||||
void publishHealthState().catch((error) => {
|
||||
console.error("Heimdall signed health publication failed on interval:", error);
|
||||
});
|
||||
}, healthPulseIntervalMs);
|
||||
void runHealthPulseLoop();
|
||||
verseTimer.unref?.();
|
||||
} catch (error) {
|
||||
app.log.error(error);
|
||||
|
|
@ -47,3 +43,12 @@ async function publishHealthState(): Promise<void> {
|
|||
observedAt: pulse.updatedAt,
|
||||
});
|
||||
}
|
||||
|
||||
async function runHealthPulseLoop(): Promise<void> {
|
||||
for (;;) {
|
||||
await new Promise((resolve) => setTimeout(resolve, healthPulseIntervalMs));
|
||||
await publishHealthState().catch((error) => {
|
||||
console.error("Heimdall signed health publication failed on interval:", error);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue