Files
klz-cables.com/.pnpm-store/v10/files/d4/94485bc33a1ac753880bd4ff9b08567328e21537c1e2ae3626ce2353a041a9eea5c81319cc54715c7c7d98fcc5ecac6cd4c8c2a1020eb865b32b843e8df147
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

54 lines
1.3 KiB
Plaintext

/**
* Gets all queued jobs that can be run. This means they either:
* - failed but do not have a definitive error => can be retried
* - are currently processing
* - have not been started yet
*/ export async function countRunnableOrActiveJobsForQueue({ onlyScheduled = false, queue, req, taskSlug, workflowSlug }) {
const and = [
{
queue: {
equals: queue
}
},
{
completedAt: {
exists: false
}
},
{
error: {
exists: false
}
}
];
if (taskSlug) {
and.push({
taskSlug: {
equals: taskSlug
}
});
} else if (workflowSlug) {
and.push({
workflowSlug: {
equals: workflowSlug
}
});
}
if (onlyScheduled) {
and.push({
'meta.scheduled': {
equals: true
}
});
}
const runnableOrActiveJobsForQueue = await req.payload.db.count({
collection: 'payload-jobs',
req,
where: {
and
}
});
return runnableOrActiveJobsForQueue.totalDocs;
}
//# sourceMappingURL=countRunnableOrActiveJobsForQueue.js.map