feat(worker): EOC push-agent for ops summary
- Add EOC_URL + EOC_PUSH_TOKEN config - Add pushOpsSummaryToEoc processor - Schedule PUSH_OPS_SUMMARY_TO_EOC every 2 minutes - Add unit tests
This commit is contained in:
@@ -22,6 +22,7 @@ import {
|
||||
} from "./processors/maintenance.js";
|
||||
import { processSafetyCanary } from "./processors/safety-canary.js";
|
||||
import { refreshOpsSummaryCache } from "./processors/ops-summary.js";
|
||||
import { pushOpsSummaryToEoc } from "./processors/eoc-push.js";
|
||||
|
||||
import {
|
||||
DEAD_LETTER_QUEUE_NAME,
|
||||
@@ -145,6 +146,12 @@ const worker = new Worker(
|
||||
return;
|
||||
}
|
||||
|
||||
case "PUSH_OPS_SUMMARY_TO_EOC": {
|
||||
const result = await pushOpsSummaryToEoc(ctx.redis!);
|
||||
log(`EOC push: ${result.ok ? "OK" : "FEL"}${result.error ? ` (${result.error})` : ""}`);
|
||||
return;
|
||||
}
|
||||
|
||||
// Deterministiska/planerade jobb som inte kräver egen processor ännu
|
||||
case "NORMALIZE_PRODUCTS":
|
||||
case "DEDUPLICATE_INVENTORY":
|
||||
@@ -293,6 +300,15 @@ async function registerRepeatableJobs() {
|
||||
opts: baseOpts,
|
||||
},
|
||||
);
|
||||
await queue.upsertJobScheduler(
|
||||
"scheduler-eoc-push",
|
||||
{ every: 2 * 60 * 1000 }, // var 2:e minut
|
||||
{
|
||||
name: "PUSH_OPS_SUMMARY_TO_EOC",
|
||||
data: { jobType: "PUSH_OPS_SUMMARY_TO_EOC" },
|
||||
opts: baseOpts,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
// --- Minimal healthcheck-server så att flera instanser kan övervakas ---
|
||||
|
||||
Reference in New Issue
Block a user