Fas 2 steg 2: Inventory Trust Engine - decay-profiler och cache-jobb
This commit is contained in:
@@ -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" },
|
||||
|
||||
Reference in New Issue
Block a user