@tachybase/plugin-adapter-bullmq 1.3.17 → 1.3.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/externalVersion.js +2 -2
- package/dist/node_modules/@bull-board/api/dist/src/handlers/error.d.ts +4 -2
- package/dist/node_modules/@bull-board/api/dist/src/handlers/error.js +2 -2
- package/dist/node_modules/@bull-board/api/dist/src/handlers/pauseAll.d.ts +4 -0
- package/dist/node_modules/@bull-board/api/dist/src/handlers/pauseAll.js +15 -0
- package/dist/node_modules/@bull-board/api/dist/src/handlers/queues.js +4 -0
- package/dist/node_modules/@bull-board/api/dist/src/handlers/resumeAll.d.ts +4 -0
- package/dist/node_modules/@bull-board/api/dist/src/handlers/resumeAll.js +15 -0
- package/dist/node_modules/@bull-board/api/dist/src/index.js +1 -1
- package/dist/node_modules/@bull-board/api/dist/src/queueAdapters/base.d.ts +4 -0
- package/dist/node_modules/@bull-board/api/dist/src/queueAdapters/base.js +6 -0
- package/dist/node_modules/@bull-board/api/dist/src/queueAdapters/bull.js +6 -4
- package/dist/node_modules/@bull-board/api/dist/src/routes.js +4 -0
- package/dist/node_modules/@bull-board/api/dist/typings/app.d.ts +22 -2
- package/dist/node_modules/@bull-board/api/package.json +1 -1
- package/dist/node_modules/@bull-board/koa/dist/KoaAdapter.js +1 -1
- package/dist/node_modules/@bull-board/koa/dist/index.js +101 -101
- package/dist/node_modules/@bull-board/koa/package.json +1 -1
- package/dist/node_modules/bullmq/dist/cjs/classes/backoffs.js +18 -5
- package/dist/node_modules/bullmq/dist/cjs/classes/child-pool.js +7 -2
- package/dist/node_modules/bullmq/dist/cjs/classes/child-processor.js +59 -5
- package/dist/node_modules/bullmq/dist/cjs/classes/child.js +3 -1
- package/dist/node_modules/bullmq/dist/cjs/classes/errors/index.js +2 -1
- package/dist/node_modules/bullmq/dist/cjs/classes/errors/waiting-error.js +19 -0
- package/dist/node_modules/bullmq/dist/cjs/classes/flow-producer.js +21 -5
- package/dist/node_modules/bullmq/dist/cjs/classes/index.js +1 -0
- package/dist/node_modules/bullmq/dist/cjs/classes/job-scheduler.js +88 -62
- package/dist/node_modules/bullmq/dist/cjs/classes/job.js +216 -109
- package/dist/node_modules/bullmq/dist/cjs/classes/main-base.js +1 -1
- package/dist/node_modules/bullmq/dist/cjs/classes/queue-base.js +10 -9
- package/dist/node_modules/bullmq/dist/cjs/classes/queue-getters.js +34 -14
- package/dist/node_modules/bullmq/dist/cjs/classes/queue.js +19 -13
- package/dist/node_modules/bullmq/dist/cjs/classes/redis-connection.js +16 -9
- package/dist/node_modules/bullmq/dist/cjs/classes/repeat.js +1 -1
- package/dist/node_modules/bullmq/dist/cjs/classes/sandbox.js +54 -28
- package/dist/node_modules/bullmq/dist/cjs/classes/scripts.js +141 -39
- package/dist/node_modules/bullmq/dist/cjs/classes/worker.js +191 -182
- package/dist/node_modules/bullmq/dist/cjs/commands/addDelayedJob-6.lua +6 -17
- package/dist/node_modules/bullmq/dist/cjs/commands/addJobScheduler-11.lua +123 -0
- package/dist/node_modules/bullmq/dist/{esm/commands/addParentJob-4.lua → cjs/commands/addParentJob-5.lua} +7 -6
- package/dist/node_modules/bullmq/dist/cjs/commands/{addPrioritizedJob-8.lua → addPrioritizedJob-9.lua} +11 -10
- package/dist/node_modules/bullmq/dist/cjs/commands/addRepeatableJob-2.lua +2 -2
- package/dist/node_modules/bullmq/dist/{esm/commands/addStandardJob-8.lua → cjs/commands/addStandardJob-9.lua} +9 -8
- package/dist/node_modules/bullmq/dist/cjs/commands/cleanJobsInSet-3.lua +9 -5
- package/dist/node_modules/bullmq/dist/cjs/commands/drain-5.lua +16 -16
- package/dist/node_modules/bullmq/dist/cjs/commands/getDependencyCounts-4.lua +31 -0
- package/dist/node_modules/bullmq/dist/cjs/commands/getState-8.lua +5 -5
- package/dist/node_modules/bullmq/dist/cjs/commands/getStateV2-8.lua +8 -8
- package/dist/node_modules/bullmq/dist/cjs/commands/includes/addDelayedJob.lua +23 -0
- package/dist/node_modules/bullmq/dist/cjs/commands/includes/addJobFromScheduler.lua +37 -0
- package/dist/node_modules/bullmq/dist/cjs/commands/includes/addJobWithPriority.lua +2 -2
- package/dist/node_modules/bullmq/dist/cjs/commands/includes/cleanList.lua +4 -2
- package/dist/node_modules/bullmq/dist/cjs/commands/includes/cleanSet.lua +3 -11
- package/dist/node_modules/bullmq/dist/cjs/commands/includes/collectMetrics.lua +1 -1
- package/dist/node_modules/bullmq/dist/cjs/commands/includes/deduplicateJob.lua +63 -18
- package/dist/node_modules/bullmq/dist/cjs/commands/includes/filterOutJobsToIgnore.lua +14 -0
- package/dist/node_modules/bullmq/dist/cjs/commands/includes/getNextDelayedTimestamp.lua +1 -1
- package/dist/node_modules/bullmq/dist/cjs/commands/includes/getOrSetMaxEvents.lua +6 -6
- package/dist/node_modules/bullmq/dist/cjs/commands/includes/getPriorityScore.lua +8 -0
- package/dist/node_modules/bullmq/dist/cjs/commands/includes/isJobSchedulerJob.lua +15 -0
- package/dist/node_modules/bullmq/dist/cjs/commands/includes/isLocked.lua +1 -0
- package/dist/node_modules/bullmq/dist/cjs/commands/includes/moveChildFromDependenciesIfNeeded.lua +77 -0
- package/dist/node_modules/bullmq/dist/cjs/commands/includes/{moveJobFromPriorityToActive.lua → moveJobFromPrioritizedToActive.lua} +1 -1
- package/dist/node_modules/bullmq/dist/cjs/commands/includes/moveParentToWait.lua +45 -0
- package/dist/node_modules/bullmq/dist/cjs/commands/includes/moveParentToWaitIfNeeded.lua +9 -50
- package/dist/node_modules/bullmq/dist/cjs/commands/includes/moveParentToWaitIfNoPendingDependencies.lua +13 -0
- package/dist/node_modules/bullmq/dist/cjs/commands/includes/prepareJobForProcessing.lua +2 -1
- package/dist/node_modules/bullmq/dist/cjs/commands/includes/promoteDelayedJobs.lua +7 -3
- package/dist/node_modules/bullmq/dist/cjs/commands/includes/removeDeduplicationKeyIfNeededOnFinalization.lua +23 -0
- package/dist/node_modules/bullmq/dist/cjs/commands/includes/removeDeduplicationKeyIfNeededOnRemoval.lua +16 -0
- package/dist/node_modules/bullmq/dist/cjs/commands/includes/removeJob.lua +2 -2
- package/dist/node_modules/bullmq/dist/cjs/commands/includes/removeJobKeys.lua +2 -2
- package/dist/node_modules/bullmq/dist/cjs/commands/includes/removeJobWithChildren.lua +95 -0
- package/dist/node_modules/bullmq/dist/cjs/commands/includes/removeListJobs.lua +7 -1
- package/dist/node_modules/bullmq/dist/cjs/commands/includes/removeParentDependencyKey.lua +5 -5
- package/dist/node_modules/bullmq/dist/cjs/commands/includes/removeZSetJobs.lua +2 -8
- package/dist/node_modules/bullmq/dist/cjs/commands/includes/storeJob.lua +2 -2
- package/dist/node_modules/bullmq/dist/cjs/commands/includes/storeJobScheduler.lua +52 -0
- package/dist/node_modules/bullmq/dist/cjs/commands/includes/trimEvents.lua +1 -1
- package/dist/node_modules/bullmq/dist/cjs/commands/includes/updateExistingJobsParent.lua +1 -1
- package/dist/node_modules/bullmq/dist/cjs/commands/includes/updateJobFields.lua +5 -5
- package/dist/node_modules/bullmq/dist/cjs/commands/includes/updateParentDepsIfNeeded.lua +2 -2
- package/dist/node_modules/bullmq/dist/cjs/commands/isFinished-3.lua +2 -2
- package/dist/node_modules/bullmq/dist/cjs/commands/moveJobFromActiveToWait-9.lua +63 -0
- package/dist/node_modules/bullmq/dist/cjs/commands/moveStalledJobsToWait-8.lua +109 -0
- package/dist/node_modules/bullmq/dist/cjs/commands/moveToActive-11.lua +3 -2
- package/dist/node_modules/bullmq/dist/cjs/commands/moveToFinished-14.lua +52 -52
- package/dist/node_modules/bullmq/dist/cjs/commands/moveToWaitingChildren-8.lua +106 -0
- package/dist/node_modules/bullmq/dist/cjs/commands/removeJob-2.lua +18 -66
- package/dist/node_modules/bullmq/dist/cjs/commands/removeJobScheduler-3.lua +1 -1
- package/dist/node_modules/bullmq/dist/cjs/commands/removeUnprocessedChildren-2.lua +31 -0
- package/dist/node_modules/bullmq/dist/cjs/commands/retryJob-11.lua +11 -5
- package/dist/node_modules/bullmq/dist/cjs/commands/updateJobScheduler-12.lua +90 -0
- package/dist/node_modules/bullmq/dist/cjs/commands/updateRepeatableJobMillis-1.lua +1 -1
- package/dist/node_modules/bullmq/dist/cjs/enums/child-command.js +2 -0
- package/dist/node_modules/bullmq/dist/cjs/enums/error-code.js +2 -1
- package/dist/node_modules/bullmq/dist/cjs/enums/parent-command.js +5 -2
- package/dist/node_modules/bullmq/dist/cjs/index.js +1 -1
- package/dist/node_modules/bullmq/dist/cjs/interfaces/index.js +2 -1
- package/dist/node_modules/bullmq/dist/cjs/interfaces/{debounce-options.js → parent-options.js} +1 -1
- package/dist/node_modules/bullmq/dist/cjs/interfaces/receiver.js +3 -0
- package/dist/node_modules/bullmq/dist/cjs/scripts/addDelayedJob-6.js +163 -84
- package/dist/node_modules/bullmq/dist/cjs/scripts/addJobScheduler-11.js +465 -0
- package/dist/node_modules/bullmq/dist/cjs/scripts/{addParentJob-4.js → addParentJob-5.js} +147 -75
- package/dist/node_modules/bullmq/dist/cjs/scripts/{addPrioritizedJob-8.js → addPrioritizedJob-9.js} +151 -79
- package/dist/node_modules/bullmq/dist/cjs/scripts/addRepeatableJob-2.js +18 -13
- package/dist/node_modules/bullmq/dist/cjs/scripts/{addStandardJob-8.js → addStandardJob-9.js} +149 -77
- package/dist/node_modules/bullmq/dist/cjs/scripts/changeDelay-4.js +7 -7
- package/dist/node_modules/bullmq/dist/cjs/scripts/changePriority-7.js +8 -2
- package/dist/node_modules/bullmq/dist/cjs/scripts/cleanJobsInSet-3.js +45 -29
- package/dist/node_modules/bullmq/dist/cjs/scripts/drain-5.js +49 -35
- package/dist/node_modules/bullmq/dist/cjs/scripts/getDependencyCounts-4.js +37 -0
- package/dist/node_modules/bullmq/dist/cjs/scripts/getState-8.js +5 -5
- package/dist/node_modules/bullmq/dist/cjs/scripts/getStateV2-8.js +8 -8
- package/dist/node_modules/bullmq/dist/cjs/scripts/index.js +10 -7
- package/dist/node_modules/bullmq/dist/cjs/scripts/isFinished-3.js +2 -2
- package/dist/node_modules/bullmq/dist/cjs/scripts/{moveJobFromActiveToWait-10.js → moveJobFromActiveToWait-9.js} +57 -37
- package/dist/node_modules/bullmq/dist/cjs/scripts/moveJobsToWait-8.js +6 -6
- package/dist/node_modules/bullmq/dist/cjs/scripts/moveStalledJobsToWait-8.js +171 -0
- package/dist/node_modules/bullmq/dist/cjs/scripts/moveToActive-11.js +18 -8
- package/dist/node_modules/bullmq/dist/cjs/scripts/moveToDelayed-8.js +12 -12
- package/dist/node_modules/bullmq/dist/cjs/scripts/moveToFinished-14.js +218 -155
- package/dist/node_modules/bullmq/dist/cjs/scripts/moveToWaitingChildren-8.js +529 -0
- package/dist/node_modules/bullmq/dist/cjs/scripts/obliterate-2.js +33 -20
- package/dist/node_modules/bullmq/dist/cjs/scripts/pause-7.js +1 -1
- package/dist/node_modules/bullmq/dist/cjs/scripts/promote-9.js +8 -2
- package/dist/node_modules/bullmq/dist/cjs/scripts/removeChildDependency-1.js +7 -7
- package/dist/node_modules/bullmq/dist/cjs/scripts/removeJob-2.js +120 -63
- package/dist/node_modules/bullmq/dist/cjs/scripts/removeJobScheduler-3.js +3 -3
- package/dist/node_modules/bullmq/dist/cjs/scripts/removeRepeatable-3.js +2 -2
- package/dist/node_modules/bullmq/dist/cjs/scripts/removeUnprocessedChildren-2.js +339 -0
- package/dist/node_modules/bullmq/dist/cjs/scripts/reprocessJob-8.js +6 -6
- package/dist/node_modules/bullmq/dist/cjs/scripts/retryJob-11.js +47 -26
- package/dist/node_modules/bullmq/dist/cjs/scripts/updateJobScheduler-12.js +274 -0
- package/dist/node_modules/bullmq/dist/cjs/scripts/updateProgress-3.js +6 -6
- package/dist/node_modules/bullmq/dist/cjs/scripts/updateRepeatableJobMillis-1.js +1 -1
- package/dist/node_modules/bullmq/dist/cjs/tsconfig-cjs.tsbuildinfo +1 -1
- package/dist/node_modules/bullmq/dist/cjs/types/deduplication-options.js +3 -0
- package/dist/node_modules/bullmq/dist/cjs/types/index.js +3 -0
- package/dist/node_modules/bullmq/dist/cjs/types/job-progress.js +3 -0
- package/dist/node_modules/bullmq/dist/cjs/types/script-queue-context.js +3 -0
- package/dist/node_modules/bullmq/dist/cjs/utils.js +29 -1
- package/dist/node_modules/bullmq/dist/cjs/version.js +1 -1
- package/dist/node_modules/bullmq/dist/esm/classes/backoffs.d.ts +1 -1
- package/dist/node_modules/bullmq/dist/esm/classes/backoffs.js +18 -5
- package/dist/node_modules/bullmq/dist/esm/classes/child-pool.d.ts +1 -1
- package/dist/node_modules/bullmq/dist/esm/classes/child-pool.js +7 -2
- package/dist/node_modules/bullmq/dist/esm/classes/child-processor.d.ts +3 -2
- package/dist/node_modules/bullmq/dist/esm/classes/child-processor.js +59 -5
- package/dist/node_modules/bullmq/dist/esm/classes/child.js +3 -1
- package/dist/node_modules/bullmq/dist/esm/classes/errors/index.d.ts +2 -1
- package/dist/node_modules/bullmq/dist/esm/classes/errors/index.js +2 -1
- package/dist/node_modules/bullmq/dist/esm/classes/errors/waiting-error.d.ts +10 -0
- package/dist/node_modules/bullmq/dist/esm/classes/errors/waiting-error.js +15 -0
- package/dist/node_modules/bullmq/dist/esm/classes/flow-producer.d.ts +3 -9
- package/dist/node_modules/bullmq/dist/esm/classes/flow-producer.js +21 -5
- package/dist/node_modules/bullmq/dist/esm/classes/index.d.ts +1 -0
- package/dist/node_modules/bullmq/dist/esm/classes/index.js +1 -0
- package/dist/node_modules/bullmq/dist/esm/classes/job-scheduler.d.ts +2 -2
- package/dist/node_modules/bullmq/dist/esm/classes/job-scheduler.js +88 -62
- package/dist/node_modules/bullmq/dist/esm/classes/job.d.ts +69 -19
- package/dist/node_modules/bullmq/dist/esm/classes/job.js +217 -110
- package/dist/node_modules/bullmq/dist/esm/classes/main-base.d.ts +2 -3
- package/dist/node_modules/bullmq/dist/esm/classes/main-base.js +1 -1
- package/dist/node_modules/bullmq/dist/esm/classes/queue-base.d.ts +2 -5
- package/dist/node_modules/bullmq/dist/esm/classes/queue-base.js +11 -10
- package/dist/node_modules/bullmq/dist/esm/classes/queue-events-producer.d.ts +2 -2
- package/dist/node_modules/bullmq/dist/esm/classes/queue-events.d.ts +118 -29
- package/dist/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts +20 -13
- package/dist/node_modules/bullmq/dist/esm/classes/queue-getters.js +34 -14
- package/dist/node_modules/bullmq/dist/esm/classes/queue.d.ts +19 -16
- package/dist/node_modules/bullmq/dist/esm/classes/queue.js +19 -13
- package/dist/node_modules/bullmq/dist/esm/classes/redis-connection.d.ts +7 -3
- package/dist/node_modules/bullmq/dist/esm/classes/redis-connection.js +16 -9
- package/dist/node_modules/bullmq/dist/esm/classes/repeat.js +1 -1
- package/dist/node_modules/bullmq/dist/esm/classes/sandbox.js +54 -28
- package/dist/node_modules/bullmq/dist/esm/classes/scripts.d.ts +20 -13
- package/dist/node_modules/bullmq/dist/esm/classes/scripts.js +141 -39
- package/dist/node_modules/bullmq/dist/esm/classes/worker.d.ts +28 -7
- package/dist/node_modules/bullmq/dist/esm/classes/worker.js +192 -183
- package/dist/node_modules/bullmq/dist/esm/commands/addDelayedJob-6.lua +6 -17
- package/dist/node_modules/bullmq/dist/esm/commands/addJobScheduler-11.lua +123 -0
- package/dist/node_modules/bullmq/dist/{cjs/commands/addParentJob-4.lua → esm/commands/addParentJob-5.lua} +7 -6
- package/dist/node_modules/bullmq/dist/esm/commands/{addPrioritizedJob-8.lua → addPrioritizedJob-9.lua} +11 -10
- package/dist/node_modules/bullmq/dist/esm/commands/addRepeatableJob-2.lua +2 -2
- package/dist/node_modules/bullmq/dist/{cjs/commands/addStandardJob-8.lua → esm/commands/addStandardJob-9.lua} +9 -8
- package/dist/node_modules/bullmq/dist/esm/commands/cleanJobsInSet-3.lua +9 -5
- package/dist/node_modules/bullmq/dist/esm/commands/drain-5.lua +16 -16
- package/dist/node_modules/bullmq/dist/esm/commands/getDependencyCounts-4.lua +31 -0
- package/dist/node_modules/bullmq/dist/esm/commands/getState-8.lua +5 -5
- package/dist/node_modules/bullmq/dist/esm/commands/getStateV2-8.lua +8 -8
- package/dist/node_modules/bullmq/dist/esm/commands/includes/addDelayedJob.lua +23 -0
- package/dist/node_modules/bullmq/dist/esm/commands/includes/addJobFromScheduler.lua +37 -0
- package/dist/node_modules/bullmq/dist/esm/commands/includes/addJobWithPriority.lua +2 -2
- package/dist/node_modules/bullmq/dist/esm/commands/includes/cleanList.lua +4 -2
- package/dist/node_modules/bullmq/dist/esm/commands/includes/cleanSet.lua +3 -11
- package/dist/node_modules/bullmq/dist/esm/commands/includes/collectMetrics.lua +1 -1
- package/dist/node_modules/bullmq/dist/esm/commands/includes/deduplicateJob.lua +63 -18
- package/dist/node_modules/bullmq/dist/esm/commands/includes/filterOutJobsToIgnore.lua +14 -0
- package/dist/node_modules/bullmq/dist/esm/commands/includes/getNextDelayedTimestamp.lua +1 -1
- package/dist/node_modules/bullmq/dist/esm/commands/includes/getOrSetMaxEvents.lua +6 -6
- package/dist/node_modules/bullmq/dist/esm/commands/includes/getPriorityScore.lua +8 -0
- package/dist/node_modules/bullmq/dist/esm/commands/includes/isJobSchedulerJob.lua +15 -0
- package/dist/node_modules/bullmq/dist/esm/commands/includes/isLocked.lua +1 -0
- package/dist/node_modules/bullmq/dist/esm/commands/includes/moveChildFromDependenciesIfNeeded.lua +77 -0
- package/dist/node_modules/bullmq/dist/esm/commands/includes/{moveJobFromPriorityToActive.lua → moveJobFromPrioritizedToActive.lua} +1 -1
- package/dist/node_modules/bullmq/dist/esm/commands/includes/moveParentToWait.lua +45 -0
- package/dist/node_modules/bullmq/dist/esm/commands/includes/moveParentToWaitIfNeeded.lua +9 -50
- package/dist/node_modules/bullmq/dist/esm/commands/includes/moveParentToWaitIfNoPendingDependencies.lua +13 -0
- package/dist/node_modules/bullmq/dist/esm/commands/includes/prepareJobForProcessing.lua +2 -1
- package/dist/node_modules/bullmq/dist/esm/commands/includes/promoteDelayedJobs.lua +7 -3
- package/dist/node_modules/bullmq/dist/esm/commands/includes/removeDeduplicationKeyIfNeededOnFinalization.lua +23 -0
- package/dist/node_modules/bullmq/dist/esm/commands/includes/removeDeduplicationKeyIfNeededOnRemoval.lua +16 -0
- package/dist/node_modules/bullmq/dist/esm/commands/includes/removeJob.lua +2 -2
- package/dist/node_modules/bullmq/dist/esm/commands/includes/removeJobKeys.lua +2 -2
- package/dist/node_modules/bullmq/dist/esm/commands/includes/removeJobWithChildren.lua +95 -0
- package/dist/node_modules/bullmq/dist/esm/commands/includes/removeListJobs.lua +7 -1
- package/dist/node_modules/bullmq/dist/esm/commands/includes/removeParentDependencyKey.lua +5 -5
- package/dist/node_modules/bullmq/dist/esm/commands/includes/removeZSetJobs.lua +2 -8
- package/dist/node_modules/bullmq/dist/esm/commands/includes/storeJob.lua +2 -2
- package/dist/node_modules/bullmq/dist/esm/commands/includes/storeJobScheduler.lua +52 -0
- package/dist/node_modules/bullmq/dist/esm/commands/includes/trimEvents.lua +1 -1
- package/dist/node_modules/bullmq/dist/esm/commands/includes/updateExistingJobsParent.lua +1 -1
- package/dist/node_modules/bullmq/dist/esm/commands/includes/updateJobFields.lua +5 -5
- package/dist/node_modules/bullmq/dist/esm/commands/includes/updateParentDepsIfNeeded.lua +2 -2
- package/dist/node_modules/bullmq/dist/esm/commands/isFinished-3.lua +2 -2
- package/dist/node_modules/bullmq/dist/esm/commands/moveJobFromActiveToWait-9.lua +63 -0
- package/dist/node_modules/bullmq/dist/esm/commands/moveStalledJobsToWait-8.lua +109 -0
- package/dist/node_modules/bullmq/dist/esm/commands/moveToActive-11.lua +3 -2
- package/dist/node_modules/bullmq/dist/esm/commands/moveToFinished-14.lua +52 -52
- package/dist/node_modules/bullmq/dist/esm/commands/moveToWaitingChildren-8.lua +106 -0
- package/dist/node_modules/bullmq/dist/esm/commands/removeJob-2.lua +18 -66
- package/dist/node_modules/bullmq/dist/esm/commands/removeJobScheduler-3.lua +1 -1
- package/dist/node_modules/bullmq/dist/esm/commands/removeUnprocessedChildren-2.lua +31 -0
- package/dist/node_modules/bullmq/dist/esm/commands/retryJob-11.lua +11 -5
- package/dist/node_modules/bullmq/dist/esm/commands/updateJobScheduler-12.lua +90 -0
- package/dist/node_modules/bullmq/dist/esm/commands/updateRepeatableJobMillis-1.lua +1 -1
- package/dist/node_modules/bullmq/dist/esm/enums/child-command.d.ts +3 -1
- package/dist/node_modules/bullmq/dist/esm/enums/child-command.js +2 -0
- package/dist/node_modules/bullmq/dist/esm/enums/error-code.d.ts +3 -2
- package/dist/node_modules/bullmq/dist/esm/enums/error-code.js +2 -1
- package/dist/node_modules/bullmq/dist/esm/enums/parent-command.d.ts +5 -2
- package/dist/node_modules/bullmq/dist/esm/enums/parent-command.js +5 -2
- package/dist/node_modules/bullmq/dist/esm/interfaces/backoff-options.d.ts +5 -0
- package/dist/node_modules/bullmq/dist/esm/interfaces/base-job-options.d.ts +3 -9
- package/dist/node_modules/bullmq/dist/esm/interfaces/child-message.d.ts +1 -0
- package/dist/node_modules/bullmq/dist/esm/interfaces/index.d.ts +2 -1
- package/dist/node_modules/bullmq/dist/esm/interfaces/index.js +2 -1
- package/dist/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts +6 -2
- package/dist/node_modules/bullmq/dist/esm/interfaces/job-scheduler-json.d.ts +7 -4
- package/dist/node_modules/bullmq/dist/esm/interfaces/minimal-job.d.ts +34 -15
- package/dist/node_modules/bullmq/dist/esm/interfaces/parent-options.d.ts +11 -0
- package/dist/node_modules/bullmq/dist/esm/interfaces/parent-options.js +2 -0
- package/dist/node_modules/bullmq/dist/esm/interfaces/parent.d.ts +6 -2
- package/dist/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts +15 -6
- package/dist/node_modules/bullmq/dist/esm/interfaces/receiver.d.ts +4 -0
- package/dist/node_modules/bullmq/dist/esm/interfaces/receiver.js +2 -0
- package/dist/node_modules/bullmq/dist/esm/interfaces/repeat-options.d.ts +1 -2
- package/dist/node_modules/bullmq/dist/esm/interfaces/repeatable-options.d.ts +2 -0
- package/dist/node_modules/bullmq/dist/esm/interfaces/sandboxed-job.d.ts +3 -2
- package/dist/node_modules/bullmq/dist/esm/interfaces/sandboxed-options.d.ts +1 -1
- package/dist/node_modules/bullmq/dist/esm/interfaces/telemetry.d.ts +18 -15
- package/dist/node_modules/bullmq/dist/esm/interfaces/worker-options.d.ts +10 -10
- package/dist/node_modules/bullmq/dist/esm/scripts/addDelayedJob-6.js +163 -84
- package/dist/node_modules/bullmq/dist/esm/scripts/addJobScheduler-11.js +462 -0
- package/dist/node_modules/bullmq/dist/esm/scripts/{addParentJob-4.js → addParentJob-5.js} +147 -75
- package/dist/node_modules/bullmq/dist/esm/scripts/{addPrioritizedJob-8.js → addPrioritizedJob-9.js} +151 -79
- package/dist/node_modules/bullmq/dist/esm/scripts/addRepeatableJob-2.js +18 -13
- package/dist/node_modules/bullmq/dist/esm/scripts/{addStandardJob-8.js → addStandardJob-9.js} +149 -77
- package/dist/node_modules/bullmq/dist/esm/scripts/changeDelay-4.js +7 -7
- package/dist/node_modules/bullmq/dist/esm/scripts/changePriority-7.js +8 -2
- package/dist/node_modules/bullmq/dist/esm/scripts/cleanJobsInSet-3.js +45 -29
- package/dist/node_modules/bullmq/dist/esm/scripts/drain-5.js +49 -35
- package/dist/node_modules/bullmq/dist/esm/scripts/getDependencyCounts-4.d.ts +5 -0
- package/dist/node_modules/bullmq/dist/esm/scripts/getDependencyCounts-4.js +34 -0
- package/dist/node_modules/bullmq/dist/esm/scripts/getState-8.js +5 -5
- package/dist/node_modules/bullmq/dist/esm/scripts/getStateV2-8.js +8 -8
- package/dist/node_modules/bullmq/dist/esm/scripts/index.d.ts +10 -7
- package/dist/node_modules/bullmq/dist/esm/scripts/index.js +10 -7
- package/dist/node_modules/bullmq/dist/esm/scripts/isFinished-3.js +2 -2
- package/dist/node_modules/bullmq/dist/esm/scripts/{moveJobFromActiveToWait-10.js → moveJobFromActiveToWait-9.js} +57 -37
- package/dist/node_modules/bullmq/dist/esm/scripts/moveJobsToWait-8.js +6 -6
- package/dist/node_modules/bullmq/dist/esm/scripts/moveStalledJobsToWait-8.js +168 -0
- package/dist/node_modules/bullmq/dist/esm/scripts/moveToActive-11.js +18 -8
- package/dist/node_modules/bullmq/dist/esm/scripts/moveToDelayed-8.js +12 -12
- package/dist/node_modules/bullmq/dist/esm/scripts/moveToFinished-14.js +218 -155
- package/dist/node_modules/bullmq/dist/esm/scripts/moveToWaitingChildren-8.js +526 -0
- package/dist/node_modules/bullmq/dist/esm/scripts/obliterate-2.js +33 -20
- package/dist/node_modules/bullmq/dist/esm/scripts/pause-7.js +1 -1
- package/dist/node_modules/bullmq/dist/esm/scripts/promote-9.js +8 -2
- package/dist/node_modules/bullmq/dist/esm/scripts/removeChildDependency-1.js +7 -7
- package/dist/node_modules/bullmq/dist/esm/scripts/removeJob-2.js +120 -63
- package/dist/node_modules/bullmq/dist/esm/scripts/removeJobScheduler-3.js +3 -3
- package/dist/node_modules/bullmq/dist/esm/scripts/removeRepeatable-3.js +2 -2
- package/dist/node_modules/bullmq/dist/esm/scripts/removeUnprocessedChildren-2.d.ts +5 -0
- package/dist/node_modules/bullmq/dist/esm/scripts/removeUnprocessedChildren-2.js +336 -0
- package/dist/node_modules/bullmq/dist/esm/scripts/reprocessJob-8.js +6 -6
- package/dist/node_modules/bullmq/dist/esm/scripts/retryJob-11.js +47 -26
- package/dist/node_modules/bullmq/dist/esm/scripts/updateJobScheduler-12.d.ts +5 -0
- package/dist/node_modules/bullmq/dist/esm/scripts/updateJobScheduler-12.js +271 -0
- package/dist/node_modules/bullmq/dist/esm/scripts/updateProgress-3.js +6 -6
- package/dist/node_modules/bullmq/dist/esm/scripts/updateRepeatableJobMillis-1.js +1 -1
- package/dist/node_modules/bullmq/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/dist/node_modules/bullmq/dist/esm/types/deduplication-options.d.ts +22 -0
- package/dist/node_modules/bullmq/dist/esm/types/deduplication-options.js +2 -0
- package/dist/node_modules/bullmq/dist/esm/types/index.d.ts +3 -0
- package/dist/node_modules/bullmq/dist/esm/types/index.js +3 -0
- package/dist/node_modules/bullmq/dist/esm/types/job-options.d.ts +19 -8
- package/dist/node_modules/bullmq/dist/esm/types/job-progress.d.ts +1 -0
- package/dist/node_modules/bullmq/dist/esm/types/job-progress.js +2 -0
- package/dist/node_modules/bullmq/dist/esm/types/script-queue-context.d.ts +2 -0
- package/dist/node_modules/bullmq/dist/esm/types/script-queue-context.js +2 -0
- package/dist/node_modules/bullmq/dist/esm/utils.d.ts +25 -5
- package/dist/node_modules/bullmq/dist/esm/utils.js +27 -0
- package/dist/node_modules/bullmq/dist/esm/version.d.ts +1 -1
- package/dist/node_modules/bullmq/dist/esm/version.js +1 -1
- package/dist/node_modules/bullmq/package.json +1 -1
- package/package.json +7 -7
- package/dist/node_modules/bullmq/dist/cjs/commands/addJobScheduler-2.lua +0 -91
- package/dist/node_modules/bullmq/dist/cjs/commands/includes/moveParentFromWaitingChildrenToFailed.lua +0 -53
- package/dist/node_modules/bullmq/dist/cjs/commands/includes/removeDeduplicationKey.lua +0 -11
- package/dist/node_modules/bullmq/dist/cjs/commands/includes/removeDeduplicationKeyIfNeeded.lua +0 -14
- package/dist/node_modules/bullmq/dist/cjs/commands/moveJobFromActiveToWait-10.lua +0 -60
- package/dist/node_modules/bullmq/dist/cjs/commands/moveStalledJobsToWait-9.lua +0 -156
- package/dist/node_modules/bullmq/dist/cjs/commands/moveToWaitingChildren-5.lua +0 -68
- package/dist/node_modules/bullmq/dist/cjs/scripts/addJobScheduler-2.js +0 -237
- package/dist/node_modules/bullmq/dist/cjs/scripts/moveStalledJobsToWait-9.js +0 -529
- package/dist/node_modules/bullmq/dist/cjs/scripts/moveToWaitingChildren-5.js +0 -83
- package/dist/node_modules/bullmq/dist/esm/commands/addJobScheduler-2.lua +0 -91
- package/dist/node_modules/bullmq/dist/esm/commands/includes/moveParentFromWaitingChildrenToFailed.lua +0 -53
- package/dist/node_modules/bullmq/dist/esm/commands/includes/removeDeduplicationKey.lua +0 -11
- package/dist/node_modules/bullmq/dist/esm/commands/includes/removeDeduplicationKeyIfNeeded.lua +0 -14
- package/dist/node_modules/bullmq/dist/esm/commands/moveJobFromActiveToWait-10.lua +0 -60
- package/dist/node_modules/bullmq/dist/esm/commands/moveStalledJobsToWait-9.lua +0 -156
- package/dist/node_modules/bullmq/dist/esm/commands/moveToWaitingChildren-5.lua +0 -68
- package/dist/node_modules/bullmq/dist/esm/interfaces/debounce-options.d.ts +0 -13
- package/dist/node_modules/bullmq/dist/esm/interfaces/debounce-options.js +0 -2
- package/dist/node_modules/bullmq/dist/esm/scripts/addJobScheduler-2.js +0 -234
- package/dist/node_modules/bullmq/dist/esm/scripts/moveStalledJobsToWait-9.js +0 -526
- package/dist/node_modules/bullmq/dist/esm/scripts/moveToWaitingChildren-5.js +0 -80
- /package/dist/node_modules/bullmq/dist/esm/scripts/{addJobScheduler-2.d.ts → addJobScheduler-11.d.ts} +0 -0
- /package/dist/node_modules/bullmq/dist/esm/scripts/{addParentJob-4.d.ts → addParentJob-5.d.ts} +0 -0
- /package/dist/node_modules/bullmq/dist/esm/scripts/{addPrioritizedJob-8.d.ts → addPrioritizedJob-9.d.ts} +0 -0
- /package/dist/node_modules/bullmq/dist/esm/scripts/{addStandardJob-8.d.ts → addStandardJob-9.d.ts} +0 -0
- /package/dist/node_modules/bullmq/dist/esm/scripts/{moveJobFromActiveToWait-10.d.ts → moveJobFromActiveToWait-9.d.ts} +0 -0
- /package/dist/node_modules/bullmq/dist/esm/scripts/{moveStalledJobsToWait-9.d.ts → moveStalledJobsToWait-8.d.ts} +0 -0
- /package/dist/node_modules/bullmq/dist/esm/scripts/{moveToWaitingChildren-5.d.ts → moveToWaitingChildren-8.d.ts} +0 -0
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.removeUnprocessedChildren = void 0;
|
|
4
|
+
const content = `--[[
|
|
5
|
+
Remove a job from all the statuses it may be in as well as all its data.
|
|
6
|
+
In order to be able to remove a job, it cannot be active.
|
|
7
|
+
Input:
|
|
8
|
+
KEYS[1] jobKey
|
|
9
|
+
KEYS[2] meta key
|
|
10
|
+
ARGV[1] prefix
|
|
11
|
+
ARGV[2] jobId
|
|
12
|
+
Events:
|
|
13
|
+
'removed' for every children removed
|
|
14
|
+
]]
|
|
15
|
+
-- Includes
|
|
16
|
+
--[[
|
|
17
|
+
Remove a job from all the statuses it may be in as well as all its data,
|
|
18
|
+
including its children. Active children can be ignored.
|
|
19
|
+
Events:
|
|
20
|
+
'removed'
|
|
21
|
+
]]
|
|
22
|
+
local rcall = redis.call
|
|
23
|
+
-- Includes
|
|
24
|
+
--[[
|
|
25
|
+
Functions to destructure job key.
|
|
26
|
+
Just a bit of warning, these functions may be a bit slow and affect performance significantly.
|
|
27
|
+
]]
|
|
28
|
+
local getJobIdFromKey = function (jobKey)
|
|
29
|
+
return string.match(jobKey, ".*:(.*)")
|
|
30
|
+
end
|
|
31
|
+
local getJobKeyPrefix = function (jobKey, jobId)
|
|
32
|
+
return string.sub(jobKey, 0, #jobKey - #jobId)
|
|
33
|
+
end
|
|
34
|
+
--[[
|
|
35
|
+
Function to get max events value or set by default 10000.
|
|
36
|
+
]]
|
|
37
|
+
local function getOrSetMaxEvents(metaKey)
|
|
38
|
+
local maxEvents = rcall("HGET", metaKey, "opts.maxLenEvents")
|
|
39
|
+
if not maxEvents then
|
|
40
|
+
maxEvents = 10000
|
|
41
|
+
rcall("HSET", metaKey, "opts.maxLenEvents", maxEvents)
|
|
42
|
+
end
|
|
43
|
+
return maxEvents
|
|
44
|
+
end
|
|
45
|
+
--[[
|
|
46
|
+
Function to check if the job belongs to a job scheduler and
|
|
47
|
+
current delayed job matches with jobId
|
|
48
|
+
]]
|
|
49
|
+
local function isJobSchedulerJob(jobId, jobKey, jobSchedulersKey)
|
|
50
|
+
local repeatJobKey = rcall("HGET", jobKey, "rjk")
|
|
51
|
+
if repeatJobKey then
|
|
52
|
+
local prevMillis = rcall("ZSCORE", jobSchedulersKey, repeatJobKey)
|
|
53
|
+
if prevMillis then
|
|
54
|
+
local currentDelayedJobId = "repeat:" .. repeatJobKey .. ":" .. prevMillis
|
|
55
|
+
return jobId == currentDelayedJobId
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
return false
|
|
59
|
+
end
|
|
60
|
+
--[[
|
|
61
|
+
Function to remove deduplication key if needed
|
|
62
|
+
when a job is being removed.
|
|
63
|
+
]]
|
|
64
|
+
local function removeDeduplicationKeyIfNeededOnRemoval(prefixKey,
|
|
65
|
+
jobKey, jobId)
|
|
66
|
+
local deduplicationId = rcall("HGET", jobKey, "deid")
|
|
67
|
+
if deduplicationId then
|
|
68
|
+
local deduplicationKey = prefixKey .. "de:" .. deduplicationId
|
|
69
|
+
local currentJobId = rcall('GET', deduplicationKey)
|
|
70
|
+
if currentJobId and currentJobId == jobId then
|
|
71
|
+
return rcall("DEL", deduplicationKey)
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
--[[
|
|
76
|
+
Function to remove from any state.
|
|
77
|
+
returns:
|
|
78
|
+
prev state
|
|
79
|
+
]]
|
|
80
|
+
local function removeJobFromAnyState( prefix, jobId)
|
|
81
|
+
-- We start with the ZSCORE checks, since they have O(1) complexity
|
|
82
|
+
if rcall("ZSCORE", prefix .. "completed", jobId) then
|
|
83
|
+
rcall("ZREM", prefix .. "completed", jobId)
|
|
84
|
+
return "completed"
|
|
85
|
+
elseif rcall("ZSCORE", prefix .. "waiting-children", jobId) then
|
|
86
|
+
rcall("ZREM", prefix .. "waiting-children", jobId)
|
|
87
|
+
return "waiting-children"
|
|
88
|
+
elseif rcall("ZSCORE", prefix .. "delayed", jobId) then
|
|
89
|
+
rcall("ZREM", prefix .. "delayed", jobId)
|
|
90
|
+
return "delayed"
|
|
91
|
+
elseif rcall("ZSCORE", prefix .. "failed", jobId) then
|
|
92
|
+
rcall("ZREM", prefix .. "failed", jobId)
|
|
93
|
+
return "failed"
|
|
94
|
+
elseif rcall("ZSCORE", prefix .. "prioritized", jobId) then
|
|
95
|
+
rcall("ZREM", prefix .. "prioritized", jobId)
|
|
96
|
+
return "prioritized"
|
|
97
|
+
-- We remove only 1 element from the list, since we assume they are not added multiple times
|
|
98
|
+
elseif rcall("LREM", prefix .. "wait", 1, jobId) == 1 then
|
|
99
|
+
return "wait"
|
|
100
|
+
elseif rcall("LREM", prefix .. "paused", 1, jobId) == 1 then
|
|
101
|
+
return "paused"
|
|
102
|
+
elseif rcall("LREM", prefix .. "active", 1, jobId) == 1 then
|
|
103
|
+
return "active"
|
|
104
|
+
end
|
|
105
|
+
return "unknown"
|
|
106
|
+
end
|
|
107
|
+
--[[
|
|
108
|
+
Function to remove job keys.
|
|
109
|
+
]]
|
|
110
|
+
local function removeJobKeys(jobKey)
|
|
111
|
+
return rcall("DEL", jobKey, jobKey .. ':logs', jobKey .. ':dependencies',
|
|
112
|
+
jobKey .. ':processed', jobKey .. ':failed', jobKey .. ':unsuccessful')
|
|
113
|
+
end
|
|
114
|
+
--[[
|
|
115
|
+
Check if this job has a parent. If so we will just remove it from
|
|
116
|
+
the parent child list, but if it is the last child we should move the parent to "wait/paused"
|
|
117
|
+
which requires code from "moveToFinished"
|
|
118
|
+
]]
|
|
119
|
+
-- Includes
|
|
120
|
+
--[[
|
|
121
|
+
Function to add job in target list and add marker if needed.
|
|
122
|
+
]]
|
|
123
|
+
-- Includes
|
|
124
|
+
--[[
|
|
125
|
+
Add marker if needed when a job is available.
|
|
126
|
+
]]
|
|
127
|
+
local function addBaseMarkerIfNeeded(markerKey, isPausedOrMaxed)
|
|
128
|
+
if not isPausedOrMaxed then
|
|
129
|
+
rcall("ZADD", markerKey, 0, "0")
|
|
130
|
+
end
|
|
131
|
+
end
|
|
132
|
+
local function addJobInTargetList(targetKey, markerKey, pushCmd, isPausedOrMaxed, jobId)
|
|
133
|
+
rcall(pushCmd, targetKey, jobId)
|
|
134
|
+
addBaseMarkerIfNeeded(markerKey, isPausedOrMaxed)
|
|
135
|
+
end
|
|
136
|
+
--[[
|
|
137
|
+
Function to check for the meta.paused key to decide if we are paused or not
|
|
138
|
+
(since an empty list and !EXISTS are not really the same).
|
|
139
|
+
]]
|
|
140
|
+
local function getTargetQueueList(queueMetaKey, activeKey, waitKey, pausedKey)
|
|
141
|
+
local queueAttributes = rcall("HMGET", queueMetaKey, "paused", "concurrency")
|
|
142
|
+
if queueAttributes[1] then
|
|
143
|
+
return pausedKey, true
|
|
144
|
+
else
|
|
145
|
+
if queueAttributes[2] then
|
|
146
|
+
local activeCount = rcall("LLEN", activeKey)
|
|
147
|
+
if activeCount >= tonumber(queueAttributes[2]) then
|
|
148
|
+
return waitKey, true
|
|
149
|
+
else
|
|
150
|
+
return waitKey, false
|
|
151
|
+
end
|
|
152
|
+
end
|
|
153
|
+
end
|
|
154
|
+
return waitKey, false
|
|
155
|
+
end
|
|
156
|
+
local function _moveParentToWait(parentPrefix, parentId, emitEvent)
|
|
157
|
+
local parentTarget, isPausedOrMaxed = getTargetQueueList(parentPrefix .. "meta", parentPrefix .. "active",
|
|
158
|
+
parentPrefix .. "wait", parentPrefix .. "paused")
|
|
159
|
+
addJobInTargetList(parentTarget, parentPrefix .. "marker", "RPUSH", isPausedOrMaxed, parentId)
|
|
160
|
+
if emitEvent then
|
|
161
|
+
local parentEventStream = parentPrefix .. "events"
|
|
162
|
+
rcall("XADD", parentEventStream, "*", "event", "waiting", "jobId", parentId, "prev", "waiting-children")
|
|
163
|
+
end
|
|
164
|
+
end
|
|
165
|
+
local function removeParentDependencyKey(jobKey, hard, parentKey, baseKey, debounceId)
|
|
166
|
+
if parentKey then
|
|
167
|
+
local parentDependenciesKey = parentKey .. ":dependencies"
|
|
168
|
+
local result = rcall("SREM", parentDependenciesKey, jobKey)
|
|
169
|
+
if result > 0 then
|
|
170
|
+
local pendingDependencies = rcall("SCARD", parentDependenciesKey)
|
|
171
|
+
if pendingDependencies == 0 then
|
|
172
|
+
local parentId = getJobIdFromKey(parentKey)
|
|
173
|
+
local parentPrefix = getJobKeyPrefix(parentKey, parentId)
|
|
174
|
+
local numRemovedElements = rcall("ZREM", parentPrefix .. "waiting-children", parentId)
|
|
175
|
+
if numRemovedElements == 1 then
|
|
176
|
+
if hard then -- remove parent in same queue
|
|
177
|
+
if parentPrefix == baseKey then
|
|
178
|
+
removeParentDependencyKey(parentKey, hard, nil, baseKey, nil)
|
|
179
|
+
removeJobKeys(parentKey)
|
|
180
|
+
if debounceId then
|
|
181
|
+
rcall("DEL", parentPrefix .. "de:" .. debounceId)
|
|
182
|
+
end
|
|
183
|
+
else
|
|
184
|
+
_moveParentToWait(parentPrefix, parentId)
|
|
185
|
+
end
|
|
186
|
+
else
|
|
187
|
+
_moveParentToWait(parentPrefix, parentId, true)
|
|
188
|
+
end
|
|
189
|
+
end
|
|
190
|
+
end
|
|
191
|
+
return true
|
|
192
|
+
end
|
|
193
|
+
else
|
|
194
|
+
local parentAttributes = rcall("HMGET", jobKey, "parentKey", "deid")
|
|
195
|
+
local missedParentKey = parentAttributes[1]
|
|
196
|
+
if( (type(missedParentKey) == "string") and missedParentKey ~= ""
|
|
197
|
+
and (rcall("EXISTS", missedParentKey) == 1)) then
|
|
198
|
+
local parentDependenciesKey = missedParentKey .. ":dependencies"
|
|
199
|
+
local result = rcall("SREM", parentDependenciesKey, jobKey)
|
|
200
|
+
if result > 0 then
|
|
201
|
+
local pendingDependencies = rcall("SCARD", parentDependenciesKey)
|
|
202
|
+
if pendingDependencies == 0 then
|
|
203
|
+
local parentId = getJobIdFromKey(missedParentKey)
|
|
204
|
+
local parentPrefix = getJobKeyPrefix(missedParentKey, parentId)
|
|
205
|
+
local numRemovedElements = rcall("ZREM", parentPrefix .. "waiting-children", parentId)
|
|
206
|
+
if numRemovedElements == 1 then
|
|
207
|
+
if hard then
|
|
208
|
+
if parentPrefix == baseKey then
|
|
209
|
+
removeParentDependencyKey(missedParentKey, hard, nil, baseKey, nil)
|
|
210
|
+
removeJobKeys(missedParentKey)
|
|
211
|
+
if parentAttributes[2] then
|
|
212
|
+
rcall("DEL", parentPrefix .. "de:" .. parentAttributes[2])
|
|
213
|
+
end
|
|
214
|
+
else
|
|
215
|
+
_moveParentToWait(parentPrefix, parentId)
|
|
216
|
+
end
|
|
217
|
+
else
|
|
218
|
+
_moveParentToWait(parentPrefix, parentId, true)
|
|
219
|
+
end
|
|
220
|
+
end
|
|
221
|
+
end
|
|
222
|
+
return true
|
|
223
|
+
end
|
|
224
|
+
end
|
|
225
|
+
end
|
|
226
|
+
return false
|
|
227
|
+
end
|
|
228
|
+
--[[
|
|
229
|
+
Function to recursively check if there are no locks
|
|
230
|
+
on the jobs to be removed.
|
|
231
|
+
returns:
|
|
232
|
+
boolean
|
|
233
|
+
]]
|
|
234
|
+
local function isLocked( prefix, jobId, removeChildren)
|
|
235
|
+
local jobKey = prefix .. jobId;
|
|
236
|
+
-- Check if this job is locked
|
|
237
|
+
local lockKey = jobKey .. ':lock'
|
|
238
|
+
local lock = rcall("GET", lockKey)
|
|
239
|
+
if not lock then
|
|
240
|
+
if removeChildren == "1" then
|
|
241
|
+
local dependencies = rcall("SMEMBERS", jobKey .. ":dependencies")
|
|
242
|
+
if (#dependencies > 0) then
|
|
243
|
+
for i, childJobKey in ipairs(dependencies) do
|
|
244
|
+
-- We need to get the jobId for this job.
|
|
245
|
+
local childJobId = getJobIdFromKey(childJobKey)
|
|
246
|
+
local childJobPrefix = getJobKeyPrefix(childJobKey, childJobId)
|
|
247
|
+
local result = isLocked( childJobPrefix, childJobId, removeChildren )
|
|
248
|
+
if result then
|
|
249
|
+
return true
|
|
250
|
+
end
|
|
251
|
+
end
|
|
252
|
+
end
|
|
253
|
+
end
|
|
254
|
+
return false
|
|
255
|
+
end
|
|
256
|
+
return true
|
|
257
|
+
end
|
|
258
|
+
local removeJobChildren
|
|
259
|
+
local removeJobWithChildren
|
|
260
|
+
removeJobChildren = function(prefix, jobKey, options)
|
|
261
|
+
-- Check if this job has children
|
|
262
|
+
-- If so, we are going to try to remove the children recursively in a depth-first way
|
|
263
|
+
-- because if some job is locked, we must exit with an error.
|
|
264
|
+
if not options.ignoreProcessed then
|
|
265
|
+
local processed = rcall("HGETALL", jobKey .. ":processed")
|
|
266
|
+
if #processed > 0 then
|
|
267
|
+
for i = 1, #processed, 2 do
|
|
268
|
+
local childJobId = getJobIdFromKey(processed[i])
|
|
269
|
+
local childJobPrefix = getJobKeyPrefix(processed[i], childJobId)
|
|
270
|
+
removeJobWithChildren(childJobPrefix, childJobId, jobKey, options)
|
|
271
|
+
end
|
|
272
|
+
end
|
|
273
|
+
local failed = rcall("HGETALL", jobKey .. ":failed")
|
|
274
|
+
if #failed > 0 then
|
|
275
|
+
for i = 1, #failed, 2 do
|
|
276
|
+
local childJobId = getJobIdFromKey(failed[i])
|
|
277
|
+
local childJobPrefix = getJobKeyPrefix(failed[i], childJobId)
|
|
278
|
+
removeJobWithChildren(childJobPrefix, childJobId, jobKey, options)
|
|
279
|
+
end
|
|
280
|
+
end
|
|
281
|
+
local unsuccessful = rcall("ZRANGE", jobKey .. ":unsuccessful", 0, -1)
|
|
282
|
+
if #unsuccessful > 0 then
|
|
283
|
+
for i = 1, #unsuccessful, 1 do
|
|
284
|
+
local childJobId = getJobIdFromKey(unsuccessful[i])
|
|
285
|
+
local childJobPrefix = getJobKeyPrefix(unsuccessful[i], childJobId)
|
|
286
|
+
removeJobWithChildren(childJobPrefix, childJobId, jobKey, options)
|
|
287
|
+
end
|
|
288
|
+
end
|
|
289
|
+
end
|
|
290
|
+
local dependencies = rcall("SMEMBERS", jobKey .. ":dependencies")
|
|
291
|
+
if #dependencies > 0 then
|
|
292
|
+
for i, childJobKey in ipairs(dependencies) do
|
|
293
|
+
local childJobId = getJobIdFromKey(childJobKey)
|
|
294
|
+
local childJobPrefix = getJobKeyPrefix(childJobKey, childJobId)
|
|
295
|
+
removeJobWithChildren(childJobPrefix, childJobId, jobKey, options)
|
|
296
|
+
end
|
|
297
|
+
end
|
|
298
|
+
end
|
|
299
|
+
removeJobWithChildren = function(prefix, jobId, parentKey, options)
|
|
300
|
+
local jobKey = prefix .. jobId
|
|
301
|
+
if options.ignoreLocked then
|
|
302
|
+
if isLocked(prefix, jobId) then
|
|
303
|
+
return
|
|
304
|
+
end
|
|
305
|
+
end
|
|
306
|
+
-- Check if job is in the failed zset
|
|
307
|
+
local failedSet = prefix .. "failed"
|
|
308
|
+
if not (options.ignoreProcessed and rcall("ZSCORE", failedSet, jobId)) then
|
|
309
|
+
removeParentDependencyKey(jobKey, false, parentKey, nil)
|
|
310
|
+
if options.removeChildren then
|
|
311
|
+
removeJobChildren(prefix, jobKey, options)
|
|
312
|
+
end
|
|
313
|
+
local prev = removeJobFromAnyState(prefix, jobId)
|
|
314
|
+
removeDeduplicationKeyIfNeededOnRemoval(prefix, jobKey, jobId)
|
|
315
|
+
if removeJobKeys(jobKey) > 0 then
|
|
316
|
+
local metaKey = prefix .. "meta"
|
|
317
|
+
local maxEvents = getOrSetMaxEvents(metaKey)
|
|
318
|
+
rcall("XADD", prefix .. "events", "MAXLEN", "~", maxEvents, "*", "event", "removed",
|
|
319
|
+
"jobId", jobId, "prev", prev)
|
|
320
|
+
end
|
|
321
|
+
end
|
|
322
|
+
end
|
|
323
|
+
local prefix = ARGV[1]
|
|
324
|
+
local jobId = ARGV[2]
|
|
325
|
+
local jobKey = KEYS[1]
|
|
326
|
+
local metaKey = KEYS[2]
|
|
327
|
+
local options = {
|
|
328
|
+
removeChildren = "1",
|
|
329
|
+
ignoreProcessed = true,
|
|
330
|
+
ignoreLocked = true
|
|
331
|
+
}
|
|
332
|
+
removeJobChildren(prefix, jobKey, options)
|
|
333
|
+
`;
|
|
334
|
+
exports.removeUnprocessedChildren = {
|
|
335
|
+
name: 'removeUnprocessedChildren',
|
|
336
|
+
content,
|
|
337
|
+
keys: 2,
|
|
338
|
+
};
|
|
339
|
+
//# sourceMappingURL=removeUnprocessedChildren-2.js.map
|
|
@@ -43,12 +43,12 @@ end
|
|
|
43
43
|
Function to get max events value or set by default 10000.
|
|
44
44
|
]]
|
|
45
45
|
local function getOrSetMaxEvents(metaKey)
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
46
|
+
local maxEvents = rcall("HGET", metaKey, "opts.maxLenEvents")
|
|
47
|
+
if not maxEvents then
|
|
48
|
+
maxEvents = 10000
|
|
49
|
+
rcall("HSET", metaKey, "opts.maxLenEvents", maxEvents)
|
|
50
|
+
end
|
|
51
|
+
return maxEvents
|
|
52
52
|
end
|
|
53
53
|
--[[
|
|
54
54
|
Function to check for the meta.paused key to decide if we are paused or not
|
|
@@ -20,6 +20,7 @@ const content = `--[[
|
|
|
20
20
|
ARGV[3] pushCmd
|
|
21
21
|
ARGV[4] jobId
|
|
22
22
|
ARGV[5] token
|
|
23
|
+
ARGV[6] optional job fields to update
|
|
23
24
|
Events:
|
|
24
25
|
'waiting'
|
|
25
26
|
Output:
|
|
@@ -50,10 +51,16 @@ end
|
|
|
50
51
|
Function to add job considering priority.
|
|
51
52
|
]]
|
|
52
53
|
-- Includes
|
|
54
|
+
--[[
|
|
55
|
+
Function to get priority score.
|
|
56
|
+
]]
|
|
57
|
+
local function getPriorityScore(priority, priorityCounterKey)
|
|
58
|
+
local prioCounter = rcall("INCR", priorityCounterKey)
|
|
59
|
+
return priority * 0x100000000 + prioCounter % 0x100000000
|
|
60
|
+
end
|
|
53
61
|
local function addJobWithPriority(markerKey, prioritizedKey, priority, jobId, priorityCounterKey,
|
|
54
62
|
isPausedOrMaxed)
|
|
55
|
-
local
|
|
56
|
-
local score = priority * 0x100000000 + prioCounter % 0x100000000
|
|
63
|
+
local score = getPriorityScore(priority, priorityCounterKey)
|
|
57
64
|
rcall("ZADD", prioritizedKey, score, jobId)
|
|
58
65
|
addBaseMarkerIfNeeded(markerKey, isPausedOrMaxed)
|
|
59
66
|
end
|
|
@@ -61,12 +68,12 @@ end
|
|
|
61
68
|
Function to get max events value or set by default 10000.
|
|
62
69
|
]]
|
|
63
70
|
local function getOrSetMaxEvents(metaKey)
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
71
|
+
local maxEvents = rcall("HGET", metaKey, "opts.maxLenEvents")
|
|
72
|
+
if not maxEvents then
|
|
73
|
+
maxEvents = 10000
|
|
74
|
+
rcall("HSET", metaKey, "opts.maxLenEvents", maxEvents)
|
|
75
|
+
end
|
|
76
|
+
return maxEvents
|
|
70
77
|
end
|
|
71
78
|
--[[
|
|
72
79
|
Function to check for the meta.paused key to decide if we are paused or not
|
|
@@ -88,6 +95,22 @@ local function getTargetQueueList(queueMetaKey, activeKey, waitKey, pausedKey)
|
|
|
88
95
|
end
|
|
89
96
|
return waitKey, false
|
|
90
97
|
end
|
|
98
|
+
--[[
|
|
99
|
+
Function to check if queue is paused or maxed
|
|
100
|
+
(since an empty list and !EXISTS are not really the same).
|
|
101
|
+
]]
|
|
102
|
+
local function isQueuePausedOrMaxed(queueMetaKey, activeKey)
|
|
103
|
+
local queueAttributes = rcall("HMGET", queueMetaKey, "paused", "concurrency")
|
|
104
|
+
if queueAttributes[1] then
|
|
105
|
+
return true
|
|
106
|
+
else
|
|
107
|
+
if queueAttributes[2] then
|
|
108
|
+
local activeCount = rcall("LLEN", activeKey)
|
|
109
|
+
return activeCount >= tonumber(queueAttributes[2])
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
return false
|
|
113
|
+
end
|
|
91
114
|
--[[
|
|
92
115
|
Updates the delay set, by moving delayed jobs that should
|
|
93
116
|
be processed now to "wait".
|
|
@@ -107,16 +130,17 @@ local function promoteDelayedJobs(delayedKey, markerKey, targetKey, prioritizedK
|
|
|
107
130
|
tonumber(rcall("HGET", jobKey, "priority")) or 0
|
|
108
131
|
if priority == 0 then
|
|
109
132
|
-- LIFO or FIFO
|
|
110
|
-
|
|
133
|
+
rcall("LPUSH", targetKey, jobId)
|
|
111
134
|
else
|
|
112
|
-
|
|
113
|
-
|
|
135
|
+
local score = getPriorityScore(priority, priorityCounterKey)
|
|
136
|
+
rcall("ZADD", prioritizedKey, score, jobId)
|
|
114
137
|
end
|
|
115
138
|
-- Emit waiting event
|
|
116
139
|
rcall("XADD", eventStreamKey, "*", "event", "waiting", "jobId",
|
|
117
140
|
jobId, "prev", "delayed")
|
|
118
141
|
rcall("HSET", jobKey, "delay", 0)
|
|
119
142
|
end
|
|
143
|
+
addBaseMarkerIfNeeded(markerKey, isPaused)
|
|
120
144
|
end
|
|
121
145
|
end
|
|
122
146
|
local function removeLock(jobKey, stalledKey, token, jobId)
|
|
@@ -139,34 +163,31 @@ local function removeLock(jobKey, stalledKey, token, jobId)
|
|
|
139
163
|
return 0
|
|
140
164
|
end
|
|
141
165
|
--[[
|
|
142
|
-
Function to
|
|
143
|
-
(since an empty list and !EXISTS are not really the same).
|
|
166
|
+
Function to update a bunch of fields in a job.
|
|
144
167
|
]]
|
|
145
|
-
local function
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
if queueAttributes[2] then
|
|
151
|
-
local activeCount = rcall("LLEN", activeKey)
|
|
152
|
-
return activeCount >= tonumber(queueAttributes[2])
|
|
168
|
+
local function updateJobFields(jobKey, msgpackedFields)
|
|
169
|
+
if msgpackedFields and #msgpackedFields > 0 then
|
|
170
|
+
local fieldsToUpdate = cmsgpack.unpack(msgpackedFields)
|
|
171
|
+
if fieldsToUpdate then
|
|
172
|
+
rcall("HMSET", jobKey, unpack(fieldsToUpdate))
|
|
153
173
|
end
|
|
154
174
|
end
|
|
155
|
-
return false
|
|
156
175
|
end
|
|
157
176
|
local target, isPausedOrMaxed = getTargetQueueList(KEYS[5], KEYS[1], KEYS[2], KEYS[3])
|
|
158
177
|
local markerKey = KEYS[10]
|
|
159
178
|
-- Check if there are delayed jobs that we can move to wait.
|
|
160
179
|
-- test example: when there are delayed jobs between retries
|
|
161
180
|
promoteDelayedJobs(KEYS[7], markerKey, target, KEYS[8], KEYS[6], ARGV[1], ARGV[2], KEYS[9], isPausedOrMaxed)
|
|
162
|
-
|
|
163
|
-
|
|
181
|
+
local jobKey = KEYS[4]
|
|
182
|
+
if rcall("EXISTS", jobKey) == 1 then
|
|
183
|
+
local errorCode = removeLock(jobKey, KEYS[11], ARGV[5], ARGV[4])
|
|
164
184
|
if errorCode < 0 then
|
|
165
185
|
return errorCode
|
|
166
186
|
end
|
|
187
|
+
updateJobFields(jobKey, ARGV[6])
|
|
167
188
|
local numRemovedElements = rcall("LREM", KEYS[1], -1, ARGV[4])
|
|
168
189
|
if (numRemovedElements < 1) then return -3 end
|
|
169
|
-
local priority = tonumber(rcall("HGET",
|
|
190
|
+
local priority = tonumber(rcall("HGET", jobKey, "priority")) or 0
|
|
170
191
|
--need to re-evaluate after removing job from active
|
|
171
192
|
isPausedOrMaxed = isQueuePausedOrMaxed(KEYS[5], KEYS[1])
|
|
172
193
|
-- Standard or priority add
|
|
@@ -175,7 +196,7 @@ if rcall("EXISTS", KEYS[4]) == 1 then
|
|
|
175
196
|
else
|
|
176
197
|
addJobWithPriority(markerKey, KEYS[8], priority, ARGV[4], KEYS[9], isPausedOrMaxed)
|
|
177
198
|
end
|
|
178
|
-
rcall("HINCRBY",
|
|
199
|
+
rcall("HINCRBY", jobKey, "atm", 1)
|
|
179
200
|
local maxEvents = getOrSetMaxEvents(KEYS[5])
|
|
180
201
|
-- Emit waiting event
|
|
181
202
|
rcall("XADD", KEYS[6], "MAXLEN", "~", maxEvents, "*", "event", "waiting",
|