mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-15 08:34:52 +00:00
move health alert to queue
This commit is contained in:
@@ -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
|
||||
};
|
||||
};
|
||||
|
||||
@@ -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
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user