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
@@ -891,7 +891,7 @@ export const gatewayV2ServiceFactory = ({
});
};
const $healthcheckNotify = async () => {
const healthcheckNotify = async () => {
const unhealthyGateways = await gatewayV2DAL.find({
isHeartbeatStale: true
});
@@ -945,18 +945,6 @@ export const gatewayV2ServiceFactory = ({
}
};
const initializeHealthcheckNotify = async () => {
logger.info("Setting up background notification process for gateway v2 health-checks");
await $healthcheckNotify();
// run every 5 minutes
const job = new CronJob("*/5 * * * *", $healthcheckNotify);
job.start();
return job;
};
return {
listGateways,
registerGateway,
@@ -965,6 +953,6 @@ export const gatewayV2ServiceFactory = ({
deleteGatewayById,
heartbeat,
getPamSessionKey,
initializeHealthcheckNotify
healthcheckNotify
};
};
+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
};
};