diff --git a/packages/health-check/src/run.js b/packages/health-check/src/run.js index fdabdea9..95a7b5a1 100644 --- a/packages/health-check/src/run.js +++ b/packages/health-check/src/run.js @@ -1,3 +1,5 @@ +const { getYesterdayISOString } = require("./utils"); + require("yargs/yargs")(process.argv.slice(2)).command( "$0 ", "Skynet portal health checks", @@ -31,7 +33,10 @@ require("yargs/yargs")(process.argv.slice(2)).command( checks: await Promise.all(checks.map((check) => new Promise(check))), }; - // read before writing to make sure no external changes are overwritten - db.read().get(type).push(entry).write(); + db.read() // read before writing to make sure no external changes are overwritten + .get(type) // get the list of records of given type + .push(entry) // insert new record + .remove(({ date }) => date < getYesterdayISOString()) // drop old records + .write(); } ).argv;