prune state.json
This commit is contained in:
parent
2d91181843
commit
2c1ccd0557
|
@ -1,3 +1,5 @@
|
|||
const { getYesterdayISOString } = require("./utils");
|
||||
|
||||
require("yargs/yargs")(process.argv.slice(2)).command(
|
||||
"$0 <type>",
|
||||
"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;
|
||||
|
|
Reference in New Issue