Fas 2 steg 2: Inventory Trust Engine - decay-profiler och cache-jobb

This commit is contained in:
Sven (AAMOS AI)
2026-08-06 23:25:32 +07:00
parent 8ae4bf6ec3
commit bcf932d2ff
17 changed files with 18296 additions and 61 deletions
+12
View File
@@ -16,6 +16,7 @@ import {
processStoreNotification,
processSubscriptionSweep,
processTrainingExport,
processTrustDecay,
} from "./processors/maintenance.js";
import {
@@ -110,6 +111,12 @@ const worker = new Worker(
return;
}
case "UPDATE_TRUST_STATES": {
const updated = await processTrustDecay(ctx);
if (updated > 0) log(`Trust decay: ${updated} items uppdaterade`);
return;
}
// Deterministiska/planerade jobb som inte kräver egen processor ännu
case "NORMALIZE_PRODUCTS":
case "DEDUPLICATE_INVENTORY":
@@ -201,6 +208,11 @@ async function registerRepeatableJobs() {
{ every: 30_000 },
{ name: "PUBLISH_OUTBOX", data: { jobType: "PUBLISH_OUTBOX" }, opts: baseOpts },
);
await queue.upsertJobScheduler(
"scheduler-trust",
{ every: 300_000 },
{ name: "UPDATE_TRUST_STATES", data: { jobType: "UPDATE_TRUST_STATES" }, opts: baseOpts },
);
await queue.upsertJobScheduler(
"scheduler-expiry",
{ pattern: "0 7 * * *", tz: "Europe/Stockholm" },