mirror of
https://github.com/aculix/ticket-monitoring.git
synced 2026-10-27 15:25:53 +00:00
fix: treat District 'content not found' as waiting, not as a failure
A film that is announced but has no showtimes yet answers 400 with code 32, which is exactly the state you are monitoring for before a release. Counting that as a check failure meant pointing District at an upcoming film produced a false BROKEN alert every six minutes until the listing appeared. Code 32 now reports closed and carries a note through to the status endpoint and the daily heartbeat, so a typo'd content id still surfaces rather than looking like a quiet 'not open yet' forever. Other 400s, including the missing-parameter error, still fail loudly.
This commit is contained in:
1 parent
9442bca696
commit
67e97f5a6a
5 files changed
+75
-6
No files matched your search
+4
-3
@@ -76,15 +76,15 @@ async function tickProvider(cfg, p, state, now) {
|
||||
const res = await p.module.check(cfg, p, cfg.targetDate);
|
||||
input = res.kind === "open"
|
||||
? { kind: "open", extract: p.module.extract(res.data, cfg, p), now, probeMax }
|
||||
: { kind: "closed", now, probeMax };
|
||||
: { kind: "closed", now, probeMax, note: res.note ?? null };
|
||||
} catch (err) {
|
||||
input = { kind: "error", reason: String(err.message ?? err), now, probeMax };
|
||||
}
|
||||
|
||||
const { baseState, alerts } = decideProvider(pstate, input, cfg, p);
|
||||
lastTick[p.key] = { at: ts(), kind: input.kind, reason: input.reason ?? null };
|
||||
lastTick[p.key] = { at: ts(), kind: input.kind, reason: input.reason ?? input.note ?? null };
|
||||
const matched = input.extract?.matched?.length ?? 0;
|
||||
console.log(ts(), `[${p.key}] ${input.kind}${input.reason ? ` (${input.reason})` : ""}`,
|
||||
console.log(ts(), `[${p.key}] ${input.kind}${input.reason || input.note ? ` (${input.reason ?? input.note})` : ""}`,
|
||||
`| matched: ${matched} | failures: ${baseState.failures}`);
|
||||
return { pstate: baseState, alerts, input };
|
||||
}
|
||||
@@ -123,6 +123,7 @@ export async function tick(cfg) {
|
||||
label: p.label,
|
||||
kind: input.kind === "error" ? "checks failing" : merged.providers[p.key].lastGood?.kind,
|
||||
showDatesMax: merged.providers[p.key].lastGood?.showDatesMax,
|
||||
note: merged.providers[p.key].lastGood?.note,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user