move health alert to queue

This commit is contained in:
x032205
2025-10-13 00:42:40 -04:00
parent fc6e364c60
commit 957eefc7f2
5 changed files with 82 additions and 40 deletions
+2 -14
View File
@@ -1209,7 +1209,7 @@ export const relayServiceFactory = ({
return deletedRelay;
};
const $healthcheckNotify = async () => {
const healthcheckNotify = async () => {
const unhealthyRelays = await relayDAL.find({
isHeartbeatStale: true
});
@@ -1283,18 +1283,6 @@ export const relayServiceFactory = ({
}
};
const initializeHealthcheckNotify = async () => {
logger.info("Setting up background notification process for relay health-checks");
await $healthcheckNotify();
// run every 5 minutes
const job = new CronJob("*/5 * * * *", $healthcheckNotify);
job.start();
return job;
};
return {
registerRelay,
getCredentialsForGateway,
@@ -1302,6 +1290,6 @@ export const relayServiceFactory = ({
getRelays,
deleteRelay,
heartbeat,
initializeHealthcheckNotify
healthcheckNotify
};
};