This repository has been archived on 2022-10-07. You can view files and clone it, but cannot push or open issues or pull requests.
skynet-webportal/health-check/schedule.js

15 lines
430 B
JavaScript

const schedule = require("node-schedule");
const db = require("./db");
const { checks } = require("./checks");
// execute the health-check script every 5 mintues
const job = schedule.scheduleJob("*/5 * * * *", async () => {
const entry = { date: new Date().toISOString(), checks: [] };
entry.checks = await Promise.all(checks.map((check) => new Promise(check)));
db.get("entries").push(entry).write();
});
job.invoke();