feat: added heath_error_count and the cron for health check agent errors

This commit is contained in:
Charles GTE
2026-03-27 22:13:32 +01:00
parent bded273f94
commit 595ccadfb3
14 changed files with 2674 additions and 103 deletions
+11 -1
View File
@@ -2,7 +2,7 @@ import cron from "node-cron";
import {retentionCleanTask} from "@/lib/tasks/database";
import {env} from "@/env.mjs";
import {backupCleanTask} from "@/lib/tasks/cleaning";
import {deleteHealthLogsOlderThan12h} from "@/db/services/healthcheck";
import {checkAgentsHealthError, deleteHealthLogsOlderThan12h} from "@/db/services/healthcheck";
export const retentionJob = cron.schedule(env.RETENTION_CRON, async () => {
try {
@@ -29,4 +29,14 @@ export const cleaningHealthcheckLogsJob = cron.schedule(env.CLEANING_HEALTHCHECK
} catch (err) {
console.error(`[CRON] Error:`, err);
}
});
export const healthcheckAgentAndDatabaseJob = cron.schedule(env.HEALTHCHECK_CRON, async () => {
try {
console.log("Healthcheck Job : Starting task");
await checkAgentsHealthError();
} catch (err) {
console.error(`[CRON] Error:`, err);
}
});