-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathresolver.js
More file actions
44 lines (34 loc) · 1.21 KB
/
resolver.js
File metadata and controls
44 lines (34 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import { monitorHealthUpstream } from "./utils/tests.js";
import cron from "node-cron";
import {populateIIIF, produceURIs} from "./utils/produceURIs.js";
import {prunePrivate} from "./utils/prunePrivate.js";
function main() {
console.log("---------------------");
console.log("BOOTING UP HEALTH CHECK - RESOLVER");
console.log("---------------------");
// populate database if necessary
populateIIIF()
produceURIs();
// CHECK FOR DUPLICATES
// todo: https://www.phind.com/search?cache=yxa4xegiuml3tvo0ljz3sngl
// CHECK RECORDS
// scan only UNKNOWN objects (daily at 00:00)
cron.schedule("0 00 * * *", () => {
monitorHealthUpstream("UNKNOWN");
// prune objects that have been published from the other list.
prunePrivate()
console.log("ONLY CHECKING OBJECTS WITH STATUS: UNKNOWN");
});
// scan only UNHEALTHY objects (daily at 01:00)
cron.schedule("1 00 * * 7", () => {
monitorHealthUpstream("UNHEALTHY");
console.log("ONLY CHECKING OBJECTS WITH STATUS: UNHEALTHY");
});
// full scan (only once per week - 02:00 on friday)
cron.schedule("0 0 * * 6", () => {
monitorHealthUpstream("ALL");
console.log("SCANNING ALL OBJECTS - FULL CHECK");
});
}
// run main
main();