feat(health): probe + classify engine on a 60s cron

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
root
2026-06-02 22:55:03 +10:00
parent 5b05fd4730
commit af0cac4e6b
3 changed files with 71 additions and 0 deletions

View File

@@ -2,6 +2,9 @@ import cron from 'node-cron';
import { runSync } from './sync_source_docs.js';
import { log } from '../log.js';
import { enqueue } from '../jobs/queue.js';
import { load } from '../health/registry.js';
import { checkAll } from '../health/checker.js';
import * as statusRepo from '../db/repos/service_status.js';
export function startCron() {
// Daily at 03:00 local time
@@ -20,5 +23,13 @@ export function startCron() {
catch (e) { log.error({ err: e }, 'cron speedtest failed'); }
});
cron.schedule('*/1 * * * *', async () => {
try {
const results = await checkAll(load());
for (const r of results) await statusRepo.upsert(r);
log.info({ n: results.length }, 'health check complete');
} catch (e) { log.error({ err: e }, 'health check failed'); }
});
log.info('cron started');
}