Files
klz-cables.com/.pnpm-store/v10/files/0b/f406382681920c3b7a7299ea861b6bf83fd8a36bfb17a8caf53dc4601fd03f865f2bc592427eca71721ac13fa56bbc653476df8ad1e92e01ba484e6f94bc45
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

59 lines
2.0 KiB
Plaintext

import { jobStatsGlobalSlug } from '../../config/global.js';
import { getCurrentDate } from '../../utilities/getCurrentDate.js';
export const defaultAfterSchedule = async ({ jobStats, queueable, req })=>{
const existingQueuesConfig = jobStats?.stats?.scheduledRuns?.queues?.[queueable.scheduleConfig.queue] || {};
const queueConfig = {
...existingQueuesConfig
};
if (queueable.taskConfig) {
;
(queueConfig.tasks ??= {})[queueable.taskConfig.slug] = {
lastScheduledRun: getCurrentDate().toISOString()
};
} else if (queueable.workflowConfig) {
;
(queueConfig.workflows ??= {})[queueable.workflowConfig.slug] = {
lastScheduledRun: getCurrentDate().toISOString()
};
}
// Add to payload-jobs-stats global regardless of the status
if (jobStats) {
await req.payload.db.updateGlobal({
slug: jobStatsGlobalSlug,
data: {
...jobStats || {},
stats: {
...jobStats?.stats || {},
scheduledRuns: {
...jobStats?.stats?.scheduledRuns || {},
queues: {
...jobStats?.stats?.scheduledRuns?.queues || {},
[queueable.scheduleConfig.queue]: queueConfig
}
}
},
updatedAt: new Date().toISOString()
},
req,
returning: false
});
} else {
await req.payload.db.createGlobal({
slug: jobStatsGlobalSlug,
data: {
createdAt: getCurrentDate().toISOString(),
stats: {
scheduledRuns: {
queues: {
[queueable.scheduleConfig.queue]: queueConfig
}
}
}
},
req,
returning: false
});
}
};
//# sourceMappingURL=defaultAfterSchedule.js.map