@tachybase/plugin-adapter-bullmq 1.3.17 → 1.3.19
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 +6 -6
- 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
|
@@ -1,24 +1,69 @@
|
|
|
1
1
|
--[[
|
|
2
2
|
Function to debounce a job.
|
|
3
3
|
]]
|
|
4
|
+
-- Includes
|
|
5
|
+
--- @include "removeJobKeys"
|
|
6
|
+
local function deduplicateJob(deduplicationOpts, jobId, delayedKey, deduplicationKey, eventsKey, maxEvents,
|
|
7
|
+
prefix)
|
|
8
|
+
local deduplicationId = deduplicationOpts and deduplicationOpts['id']
|
|
9
|
+
if deduplicationId then
|
|
10
|
+
local ttl = deduplicationOpts['ttl']
|
|
11
|
+
if deduplicationOpts['replace'] and ttl and ttl > 0 then
|
|
12
|
+
local currentDebounceJobId = rcall('GET', deduplicationKey)
|
|
13
|
+
if currentDebounceJobId then
|
|
14
|
+
if rcall("ZREM", delayedKey, currentDebounceJobId) > 0 then
|
|
15
|
+
removeJobKeys(prefix .. currentDebounceJobId)
|
|
16
|
+
rcall("XADD", eventsKey, "*", "event", "removed", "jobId", currentDebounceJobId,
|
|
17
|
+
"prev", "delayed")
|
|
4
18
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
if deduplicationOpts['extend'] then
|
|
20
|
+
rcall('SET', deduplicationKey, jobId, 'PX', ttl)
|
|
21
|
+
else
|
|
22
|
+
rcall('SET', deduplicationKey, jobId, 'KEEPTTL')
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
rcall("XADD", eventsKey, "MAXLEN", "~", maxEvents, "*", "event", "deduplicated", "jobId",
|
|
26
|
+
jobId, "deduplicationId", deduplicationId, "deduplicatedJobId", currentDebounceJobId)
|
|
27
|
+
return
|
|
28
|
+
else
|
|
29
|
+
return currentDebounceJobId
|
|
30
|
+
end
|
|
31
|
+
else
|
|
32
|
+
rcall('SET', deduplicationKey, jobId, 'PX', ttl)
|
|
33
|
+
return
|
|
34
|
+
end
|
|
35
|
+
else
|
|
36
|
+
local ttl = deduplicationOpts['ttl']
|
|
37
|
+
local deduplicationKeyExists
|
|
38
|
+
if ttl then
|
|
39
|
+
if deduplicationOpts['extend'] then
|
|
40
|
+
local currentDebounceJobId = rcall('GET', deduplicationKey)
|
|
41
|
+
if currentDebounceJobId then
|
|
42
|
+
rcall('SET', deduplicationKey, currentDebounceJobId, 'PX', ttl)
|
|
43
|
+
rcall("XADD", eventsKey, "MAXLEN", "~", maxEvents, "*", "event", "debounced",
|
|
44
|
+
"jobId", currentDebounceJobId, "debounceId", deduplicationId)
|
|
45
|
+
rcall("XADD", eventsKey, "MAXLEN", "~", maxEvents, "*", "event", "deduplicated", "jobId",
|
|
46
|
+
currentDebounceJobId, "deduplicationId", deduplicationId, "deduplicatedJobId", jobId)
|
|
47
|
+
return currentDebounceJobId
|
|
48
|
+
else
|
|
49
|
+
rcall('SET', deduplicationKey, jobId, 'PX', ttl)
|
|
50
|
+
return
|
|
51
|
+
end
|
|
52
|
+
else
|
|
53
|
+
deduplicationKeyExists = not rcall('SET', deduplicationKey, jobId, 'PX', ttl, 'NX')
|
|
54
|
+
end
|
|
55
|
+
else
|
|
56
|
+
deduplicationKeyExists = not rcall('SET', deduplicationKey, jobId, 'NX')
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
if deduplicationKeyExists then
|
|
60
|
+
local currentDebounceJobId = rcall('GET', deduplicationKey)
|
|
61
|
+
rcall("XADD", eventsKey, "MAXLEN", "~", maxEvents, "*", "event", "debounced", "jobId",
|
|
62
|
+
currentDebounceJobId, "debounceId", deduplicationId)
|
|
63
|
+
rcall("XADD", eventsKey, "MAXLEN", "~", maxEvents, "*", "event", "deduplicated", "jobId",
|
|
64
|
+
currentDebounceJobId, "deduplicationId", deduplicationId, "deduplicatedJobId", jobId)
|
|
65
|
+
return currentDebounceJobId
|
|
66
|
+
end
|
|
67
|
+
end
|
|
22
68
|
end
|
|
23
|
-
end
|
|
24
69
|
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
--[[
|
|
2
|
+
Function to filter out jobs to ignore from a table.
|
|
3
|
+
]]
|
|
4
|
+
|
|
5
|
+
local function filterOutJobsToIgnore(jobs, jobsToIgnore)
|
|
6
|
+
local filteredJobs = {}
|
|
7
|
+
for i = 1, #jobs do
|
|
8
|
+
if not jobsToIgnore[jobs[i]] then
|
|
9
|
+
table.insert(filteredJobs, jobs[i])
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
return filteredJobs
|
|
13
|
+
end
|
|
14
|
+
|
|
@@ -5,7 +5,7 @@ local function getNextDelayedTimestamp(delayedKey)
|
|
|
5
5
|
local result = rcall("ZRANGE", delayedKey, 0, 0, "WITHSCORES")
|
|
6
6
|
if #result then
|
|
7
7
|
local nextTimestamp = tonumber(result[2])
|
|
8
|
-
if nextTimestamp ~= nil then
|
|
8
|
+
if nextTimestamp ~= nil then
|
|
9
9
|
return nextTimestamp / 0x1000
|
|
10
10
|
end
|
|
11
11
|
end
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
Function to get max events value or set by default 10000.
|
|
3
3
|
]]
|
|
4
4
|
local function getOrSetMaxEvents(metaKey)
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
local maxEvents = rcall("HGET", metaKey, "opts.maxLenEvents")
|
|
6
|
+
if not maxEvents then
|
|
7
|
+
maxEvents = 10000
|
|
8
|
+
rcall("HSET", metaKey, "opts.maxLenEvents", maxEvents)
|
|
9
|
+
end
|
|
10
|
+
return maxEvents
|
|
11
11
|
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
--[[
|
|
2
|
+
Function to check if the job belongs to a job scheduler and
|
|
3
|
+
current delayed job matches with jobId
|
|
4
|
+
]]
|
|
5
|
+
local function isJobSchedulerJob(jobId, jobKey, jobSchedulersKey)
|
|
6
|
+
local repeatJobKey = rcall("HGET", jobKey, "rjk")
|
|
7
|
+
if repeatJobKey then
|
|
8
|
+
local prevMillis = rcall("ZSCORE", jobSchedulersKey, repeatJobKey)
|
|
9
|
+
if prevMillis then
|
|
10
|
+
local currentDelayedJobId = "repeat:" .. repeatJobKey .. ":" .. prevMillis
|
|
11
|
+
return jobId == currentDelayedJobId
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
return false
|
|
15
|
+
end
|
package/dist/node_modules/bullmq/dist/esm/commands/includes/moveChildFromDependenciesIfNeeded.lua
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
--[[
|
|
2
|
+
Function to recursively move from waitingChildren to failed.
|
|
3
|
+
]]
|
|
4
|
+
|
|
5
|
+
-- Includes
|
|
6
|
+
--- @include "moveParentToWaitIfNoPendingDependencies"
|
|
7
|
+
--- @include "moveParentToWaitIfNeeded"
|
|
8
|
+
--- @include "moveParentToWait"
|
|
9
|
+
--- @include "removeJobsOnFail"
|
|
10
|
+
|
|
11
|
+
local moveParentToFailedIfNeeded = function (parentQueueKey, parentKey, parentId, jobIdKey, timestamp)
|
|
12
|
+
if rcall("EXISTS", parentKey) == 1 then
|
|
13
|
+
local parentWaitingChildrenKey = parentQueueKey .. ":waiting-children"
|
|
14
|
+
local parentDelayedKey = parentQueueKey .. ":delayed"
|
|
15
|
+
local parentPrioritizedKey = parentQueueKey .. ":prioritized"
|
|
16
|
+
local parentWaitingChildrenOrDelayedKey
|
|
17
|
+
local prevState
|
|
18
|
+
if rcall("ZSCORE", parentWaitingChildrenKey, parentId) then
|
|
19
|
+
parentWaitingChildrenOrDelayedKey = parentWaitingChildrenKey
|
|
20
|
+
prevState = "waiting-children"
|
|
21
|
+
elseif rcall("ZSCORE", parentDelayedKey, parentId) then
|
|
22
|
+
parentWaitingChildrenOrDelayedKey = parentDelayedKey
|
|
23
|
+
prevState = "delayed"
|
|
24
|
+
rcall("HSET", parentKey, "delay", 0)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
if parentWaitingChildrenOrDelayedKey then
|
|
28
|
+
rcall("ZREM", parentWaitingChildrenOrDelayedKey, parentId)
|
|
29
|
+
local parentQueuePrefix = parentQueueKey .. ":"
|
|
30
|
+
local parentFailedKey = parentQueueKey .. ":failed"
|
|
31
|
+
local deferredFailure = "child " .. jobIdKey .. " failed"
|
|
32
|
+
rcall("HSET", parentKey, "defa", deferredFailure)
|
|
33
|
+
moveParentToWait(parentQueueKey, parentKey, parentId, timestamp)
|
|
34
|
+
else
|
|
35
|
+
if not rcall("ZSCORE", parentQueueKey .. ":failed", parentId) then
|
|
36
|
+
local deferredFailure = "child " .. jobIdKey .. " failed"
|
|
37
|
+
rcall("HSET", parentKey, "defa", deferredFailure)
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
local moveChildFromDependenciesIfNeeded = function (rawParentData, childKey, failedReason, timestamp)
|
|
44
|
+
if rawParentData then
|
|
45
|
+
local parentData = cjson.decode(rawParentData)
|
|
46
|
+
local parentKey = parentData['queueKey'] .. ':' .. parentData['id']
|
|
47
|
+
local parentDependenciesChildrenKey = parentKey .. ":dependencies"
|
|
48
|
+
if parentData['fpof'] then
|
|
49
|
+
if rcall("SREM", parentDependenciesChildrenKey, childKey) == 1 then
|
|
50
|
+
local parentUnsuccesssfulChildrenKey = parentKey .. ":unsuccessful"
|
|
51
|
+
rcall("ZADD", parentUnsuccesssfulChildrenKey, timestamp, childKey)
|
|
52
|
+
moveParentToFailedIfNeeded(
|
|
53
|
+
parentData['queueKey'],
|
|
54
|
+
parentKey,
|
|
55
|
+
parentData['id'],
|
|
56
|
+
childKey,
|
|
57
|
+
timestamp
|
|
58
|
+
)
|
|
59
|
+
end
|
|
60
|
+
elseif parentData['cpof'] then
|
|
61
|
+
if rcall("SREM", parentDependenciesChildrenKey, childKey) == 1 then
|
|
62
|
+
local parentFailedChildrenKey = parentKey .. ":failed"
|
|
63
|
+
rcall("HSET", parentFailedChildrenKey, childKey, failedReason)
|
|
64
|
+
moveParentToWaitIfNeeded(parentData['queueKey'], parentKey, parentData['id'], timestamp)
|
|
65
|
+
end
|
|
66
|
+
elseif parentData['idof'] or parentData['rdof'] then
|
|
67
|
+
if rcall("SREM", parentDependenciesChildrenKey, childKey) == 1 then
|
|
68
|
+
moveParentToWaitIfNoPendingDependencies(parentData['queueKey'], parentDependenciesChildrenKey,
|
|
69
|
+
parentKey, parentData['id'], timestamp)
|
|
70
|
+
if parentData['idof'] then
|
|
71
|
+
local parentFailedChildrenKey = parentKey .. ":failed"
|
|
72
|
+
rcall("HSET", parentFailedChildrenKey, childKey, failedReason)
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
end
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Function to move job from prioritized state to active.
|
|
3
3
|
]]
|
|
4
4
|
|
|
5
|
-
local function
|
|
5
|
+
local function moveJobFromPrioritizedToActive(priorityKey, activeKey, priorityCounterKey)
|
|
6
6
|
local prioritizedJob = rcall("ZPOPMIN", priorityKey)
|
|
7
7
|
if #prioritizedJob > 0 then
|
|
8
8
|
rcall("LPUSH", activeKey, prioritizedJob[1])
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
--[[
|
|
2
|
+
Move parent to a wait status (wait, prioritized or delayed)
|
|
3
|
+
]]
|
|
4
|
+
|
|
5
|
+
-- Includes
|
|
6
|
+
--- @include "addDelayMarkerIfNeeded"
|
|
7
|
+
--- @include "addJobInTargetList"
|
|
8
|
+
--- @include "addJobWithPriority"
|
|
9
|
+
--- @include "isQueuePausedOrMaxed"
|
|
10
|
+
--- @include "getTargetQueueList"
|
|
11
|
+
local function moveParentToWait(parentQueueKey, parentKey, parentId, timestamp)
|
|
12
|
+
local parentWaitKey = parentQueueKey .. ":wait"
|
|
13
|
+
local parentPausedKey = parentQueueKey .. ":paused"
|
|
14
|
+
local parentActiveKey = parentQueueKey .. ":active"
|
|
15
|
+
local parentMetaKey = parentQueueKey .. ":meta"
|
|
16
|
+
|
|
17
|
+
local parentMarkerKey = parentQueueKey .. ":marker"
|
|
18
|
+
local jobAttributes = rcall("HMGET", parentKey, "priority", "delay")
|
|
19
|
+
local priority = tonumber(jobAttributes[1]) or 0
|
|
20
|
+
local delay = tonumber(jobAttributes[2]) or 0
|
|
21
|
+
|
|
22
|
+
if delay > 0 then
|
|
23
|
+
local delayedTimestamp = tonumber(timestamp) + delay
|
|
24
|
+
local score = delayedTimestamp * 0x1000
|
|
25
|
+
local parentDelayedKey = parentQueueKey .. ":delayed"
|
|
26
|
+
rcall("ZADD", parentDelayedKey, score, parentId)
|
|
27
|
+
rcall("XADD", parentQueueKey .. ":events", "*", "event", "delayed", "jobId", parentId, "delay",
|
|
28
|
+
delayedTimestamp)
|
|
29
|
+
|
|
30
|
+
addDelayMarkerIfNeeded(parentMarkerKey, parentDelayedKey)
|
|
31
|
+
else
|
|
32
|
+
if priority == 0 then
|
|
33
|
+
local parentTarget, isParentPausedOrMaxed = getTargetQueueList(parentMetaKey, parentActiveKey,
|
|
34
|
+
parentWaitKey, parentPausedKey)
|
|
35
|
+
addJobInTargetList(parentTarget, parentMarkerKey, "RPUSH", isParentPausedOrMaxed, parentId)
|
|
36
|
+
else
|
|
37
|
+
local isPausedOrMaxed = isQueuePausedOrMaxed(parentMetaKey, parentActiveKey)
|
|
38
|
+
addJobWithPriority(parentMarkerKey, parentQueueKey .. ":prioritized", priority, parentId,
|
|
39
|
+
parentQueueKey .. ":pc", isPausedOrMaxed)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
rcall("XADD", parentQueueKey .. ":events", "*", "event", "waiting", "jobId", parentId, "prev",
|
|
43
|
+
"waiting-children")
|
|
44
|
+
end
|
|
45
|
+
end
|
|
@@ -1,55 +1,14 @@
|
|
|
1
1
|
--[[
|
|
2
|
-
Validate and move parent to
|
|
2
|
+
Validate and move parent to a wait status (waiting, delayed or prioritized) if needed.
|
|
3
3
|
]]
|
|
4
|
-
|
|
5
4
|
-- Includes
|
|
6
|
-
--- @include "
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
parentKey, parentId, timestamp)
|
|
14
|
-
local isParentActive = rcall("ZSCORE",
|
|
15
|
-
parentQueueKey .. ":waiting-children", parentId)
|
|
16
|
-
if rcall("SCARD", parentDependenciesKey) == 0 and isParentActive then
|
|
17
|
-
rcall("ZREM", parentQueueKey .. ":waiting-children", parentId)
|
|
18
|
-
local parentWaitKey = parentQueueKey .. ":wait"
|
|
19
|
-
local parentPausedKey = parentQueueKey .. ":paused"
|
|
20
|
-
local parentActiveKey = parentQueueKey .. ":active"
|
|
21
|
-
local parentMetaKey = parentQueueKey .. ":meta"
|
|
22
|
-
|
|
23
|
-
local parentMarkerKey = parentQueueKey .. ":marker"
|
|
24
|
-
local jobAttributes = rcall("HMGET", parentKey, "priority", "delay")
|
|
25
|
-
local priority = tonumber(jobAttributes[1]) or 0
|
|
26
|
-
local delay = tonumber(jobAttributes[2]) or 0
|
|
27
|
-
|
|
28
|
-
if delay > 0 then
|
|
29
|
-
local delayedTimestamp = tonumber(timestamp) + delay
|
|
30
|
-
local score = delayedTimestamp * 0x1000
|
|
31
|
-
local parentDelayedKey = parentQueueKey .. ":delayed"
|
|
32
|
-
rcall("ZADD", parentDelayedKey, score, parentId)
|
|
33
|
-
rcall("XADD", parentQueueKey .. ":events", "*", "event", "delayed",
|
|
34
|
-
"jobId", parentId, "delay", delayedTimestamp)
|
|
35
|
-
|
|
36
|
-
addDelayMarkerIfNeeded(parentMarkerKey, parentDelayedKey)
|
|
37
|
-
else
|
|
38
|
-
if priority == 0 then
|
|
39
|
-
local parentTarget, isParentPausedOrMaxed =
|
|
40
|
-
getTargetQueueList(parentMetaKey, parentActiveKey, parentWaitKey,
|
|
41
|
-
parentPausedKey)
|
|
42
|
-
addJobInTargetList(parentTarget, parentMarkerKey, "RPUSH", isParentPausedOrMaxed,
|
|
43
|
-
parentId)
|
|
44
|
-
else
|
|
45
|
-
local isPausedOrMaxed = isQueuePausedOrMaxed(parentMetaKey, parentActiveKey)
|
|
46
|
-
addJobWithPriority(parentMarkerKey,
|
|
47
|
-
parentQueueKey .. ":prioritized", priority,
|
|
48
|
-
parentId, parentQueueKey .. ":pc", isPausedOrMaxed)
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
rcall("XADD", parentQueueKey .. ":events", "*", "event", "waiting",
|
|
52
|
-
"jobId", parentId, "prev", "waiting-children")
|
|
53
|
-
end
|
|
5
|
+
--- @include "moveParentToWait"
|
|
6
|
+
local function moveParentToWaitIfNeeded(parentQueueKey, parentKey, parentId, timestamp)
|
|
7
|
+
if rcall("EXISTS", parentKey) == 1 then
|
|
8
|
+
local parentWaitingChildrenKey = parentQueueKey .. ":waiting-children"
|
|
9
|
+
if rcall("ZSCORE", parentWaitingChildrenKey, parentId) then
|
|
10
|
+
rcall("ZREM", parentWaitingChildrenKey, parentId)
|
|
11
|
+
moveParentToWait(parentQueueKey, parentKey, parentId, timestamp)
|
|
54
12
|
end
|
|
13
|
+
end
|
|
55
14
|
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
--[[
|
|
2
|
+
Validate and move parent to a wait status (waiting, delayed or prioritized)
|
|
3
|
+
if no pending dependencies.
|
|
4
|
+
]]
|
|
5
|
+
-- Includes
|
|
6
|
+
--- @include "moveParentToWaitIfNeeded"
|
|
7
|
+
local function moveParentToWaitIfNoPendingDependencies(parentQueueKey, parentDependenciesKey, parentKey,
|
|
8
|
+
parentId, timestamp)
|
|
9
|
+
local doNotHavePendingDependencies = rcall("SCARD", parentDependenciesKey) == 0
|
|
10
|
+
if doNotHavePendingDependencies then
|
|
11
|
+
moveParentToWaitIfNeeded(parentQueueKey, parentKey, parentId, timestamp)
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
--[[
|
|
3
2
|
Function to move job from wait state to active.
|
|
4
3
|
Input:
|
|
@@ -46,5 +45,7 @@ local function prepareJobForProcessing(keyPrefix, rateLimiterKey, eventStreamKey
|
|
|
46
45
|
|
|
47
46
|
addBaseMarkerIfNeeded(markerKey, false)
|
|
48
47
|
|
|
48
|
+
-- rate limit delay must be 0 in this case to prevent adding more delay
|
|
49
|
+
-- when job that is moved to active needs to be processed
|
|
49
50
|
return {rcall("HGETALL", jobKey), jobId, 0, 0} -- get job data
|
|
50
51
|
end
|
|
@@ -7,8 +7,10 @@
|
|
|
7
7
|
]]
|
|
8
8
|
|
|
9
9
|
-- Includes
|
|
10
|
+
--- @include "addBaseMarkerIfNeeded"
|
|
10
11
|
--- @include "addJobInTargetList"
|
|
11
12
|
--- @include "addJobWithPriority"
|
|
13
|
+
--- @include "getPriorityScore"
|
|
12
14
|
|
|
13
15
|
-- Try to get as much as 1000 jobs at once
|
|
14
16
|
local function promoteDelayedJobs(delayedKey, markerKey, targetKey, prioritizedKey,
|
|
@@ -25,10 +27,10 @@ local function promoteDelayedJobs(delayedKey, markerKey, targetKey, prioritizedK
|
|
|
25
27
|
|
|
26
28
|
if priority == 0 then
|
|
27
29
|
-- LIFO or FIFO
|
|
28
|
-
|
|
30
|
+
rcall("LPUSH", targetKey, jobId)
|
|
29
31
|
else
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
local score = getPriorityScore(priority, priorityCounterKey)
|
|
33
|
+
rcall("ZADD", prioritizedKey, score, jobId)
|
|
32
34
|
end
|
|
33
35
|
|
|
34
36
|
-- Emit waiting event
|
|
@@ -36,5 +38,7 @@ local function promoteDelayedJobs(delayedKey, markerKey, targetKey, prioritizedK
|
|
|
36
38
|
jobId, "prev", "delayed")
|
|
37
39
|
rcall("HSET", jobKey, "delay", 0)
|
|
38
40
|
end
|
|
41
|
+
|
|
42
|
+
addBaseMarkerIfNeeded(markerKey, isPaused)
|
|
39
43
|
end
|
|
40
44
|
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
--[[
|
|
2
|
+
Function to remove deduplication key if needed
|
|
3
|
+
when a job is moved to completed or failed states.
|
|
4
|
+
]]
|
|
5
|
+
|
|
6
|
+
local function removeDeduplicationKeyIfNeededOnFinalization(prefixKey,
|
|
7
|
+
deduplicationId, jobId)
|
|
8
|
+
if deduplicationId then
|
|
9
|
+
local deduplicationKey = prefixKey .. "de:" .. deduplicationId
|
|
10
|
+
local pttl = rcall("PTTL", deduplicationKey)
|
|
11
|
+
|
|
12
|
+
if pttl == 0 then
|
|
13
|
+
return rcall("DEL", deduplicationKey)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
if pttl == -1 then
|
|
17
|
+
local currentJobId = rcall('GET', deduplicationKey)
|
|
18
|
+
if currentJobId and currentJobId == jobId then
|
|
19
|
+
return rcall("DEL", deduplicationKey)
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
--[[
|
|
2
|
+
Function to remove deduplication key if needed
|
|
3
|
+
when a job is being removed.
|
|
4
|
+
]]
|
|
5
|
+
|
|
6
|
+
local function removeDeduplicationKeyIfNeededOnRemoval(prefixKey,
|
|
7
|
+
jobKey, jobId)
|
|
8
|
+
local deduplicationId = rcall("HGET", jobKey, "deid")
|
|
9
|
+
if deduplicationId then
|
|
10
|
+
local deduplicationKey = prefixKey .. "de:" .. deduplicationId
|
|
11
|
+
local currentJobId = rcall('GET', deduplicationKey)
|
|
12
|
+
if currentJobId and currentJobId == jobId then
|
|
13
|
+
return rcall("DEL", deduplicationKey)
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
]]
|
|
4
4
|
|
|
5
5
|
-- Includes
|
|
6
|
-
--- @include "
|
|
6
|
+
--- @include "removeDeduplicationKeyIfNeededOnRemoval"
|
|
7
7
|
--- @include "removeJobKeys"
|
|
8
8
|
--- @include "removeParentDependencyKey"
|
|
9
9
|
|
|
@@ -11,7 +11,7 @@ local function removeJob(jobId, hard, baseKey, shouldRemoveDeduplicationKey)
|
|
|
11
11
|
local jobKey = baseKey .. jobId
|
|
12
12
|
removeParentDependencyKey(jobKey, hard, nil, baseKey)
|
|
13
13
|
if shouldRemoveDeduplicationKey then
|
|
14
|
-
|
|
14
|
+
removeDeduplicationKeyIfNeededOnRemoval(baseKey, jobKey, jobId)
|
|
15
15
|
end
|
|
16
16
|
removeJobKeys(jobKey)
|
|
17
17
|
end
|
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
]]
|
|
4
4
|
|
|
5
5
|
local function removeJobKeys(jobKey)
|
|
6
|
-
return rcall("DEL", jobKey, jobKey .. ':logs',
|
|
7
|
-
jobKey .. ':
|
|
6
|
+
return rcall("DEL", jobKey, jobKey .. ':logs', jobKey .. ':dependencies',
|
|
7
|
+
jobKey .. ':processed', jobKey .. ':failed', jobKey .. ':unsuccessful')
|
|
8
8
|
end
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
--[[
|
|
2
|
+
Remove a job from all the statuses it may be in as well as all its data,
|
|
3
|
+
including its children. Active children can be ignored.
|
|
4
|
+
|
|
5
|
+
Events:
|
|
6
|
+
'removed'
|
|
7
|
+
]]
|
|
8
|
+
|
|
9
|
+
local rcall = redis.call
|
|
10
|
+
|
|
11
|
+
-- Includes
|
|
12
|
+
--- @include "destructureJobKey"
|
|
13
|
+
--- @include "getOrSetMaxEvents"
|
|
14
|
+
--- @include "isJobSchedulerJob"
|
|
15
|
+
--- @include "removeDeduplicationKeyIfNeededOnRemoval"
|
|
16
|
+
--- @include "removeJobFromAnyState"
|
|
17
|
+
--- @include "removeJobKeys"
|
|
18
|
+
--- @include "removeParentDependencyKey"
|
|
19
|
+
--- @include "isLocked"
|
|
20
|
+
|
|
21
|
+
local removeJobChildren
|
|
22
|
+
local removeJobWithChildren
|
|
23
|
+
|
|
24
|
+
removeJobChildren = function(prefix, jobKey, options)
|
|
25
|
+
-- Check if this job has children
|
|
26
|
+
-- If so, we are going to try to remove the children recursively in a depth-first way
|
|
27
|
+
-- because if some job is locked, we must exit with an error.
|
|
28
|
+
|
|
29
|
+
if not options.ignoreProcessed then
|
|
30
|
+
local processed = rcall("HGETALL", jobKey .. ":processed")
|
|
31
|
+
if #processed > 0 then
|
|
32
|
+
for i = 1, #processed, 2 do
|
|
33
|
+
local childJobId = getJobIdFromKey(processed[i])
|
|
34
|
+
local childJobPrefix = getJobKeyPrefix(processed[i], childJobId)
|
|
35
|
+
removeJobWithChildren(childJobPrefix, childJobId, jobKey, options)
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
local failed = rcall("HGETALL", jobKey .. ":failed")
|
|
40
|
+
if #failed > 0 then
|
|
41
|
+
for i = 1, #failed, 2 do
|
|
42
|
+
local childJobId = getJobIdFromKey(failed[i])
|
|
43
|
+
local childJobPrefix = getJobKeyPrefix(failed[i], childJobId)
|
|
44
|
+
removeJobWithChildren(childJobPrefix, childJobId, jobKey, options)
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
local unsuccessful = rcall("ZRANGE", jobKey .. ":unsuccessful", 0, -1)
|
|
49
|
+
if #unsuccessful > 0 then
|
|
50
|
+
for i = 1, #unsuccessful, 1 do
|
|
51
|
+
local childJobId = getJobIdFromKey(unsuccessful[i])
|
|
52
|
+
local childJobPrefix = getJobKeyPrefix(unsuccessful[i], childJobId)
|
|
53
|
+
removeJobWithChildren(childJobPrefix, childJobId, jobKey, options)
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
local dependencies = rcall("SMEMBERS", jobKey .. ":dependencies")
|
|
59
|
+
if #dependencies > 0 then
|
|
60
|
+
for i, childJobKey in ipairs(dependencies) do
|
|
61
|
+
local childJobId = getJobIdFromKey(childJobKey)
|
|
62
|
+
local childJobPrefix = getJobKeyPrefix(childJobKey, childJobId)
|
|
63
|
+
removeJobWithChildren(childJobPrefix, childJobId, jobKey, options)
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
removeJobWithChildren = function(prefix, jobId, parentKey, options)
|
|
69
|
+
local jobKey = prefix .. jobId
|
|
70
|
+
|
|
71
|
+
if options.ignoreLocked then
|
|
72
|
+
if isLocked(prefix, jobId) then
|
|
73
|
+
return
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
-- Check if job is in the failed zset
|
|
78
|
+
local failedSet = prefix .. "failed"
|
|
79
|
+
if not (options.ignoreProcessed and rcall("ZSCORE", failedSet, jobId)) then
|
|
80
|
+
removeParentDependencyKey(jobKey, false, parentKey, nil)
|
|
81
|
+
|
|
82
|
+
if options.removeChildren then
|
|
83
|
+
removeJobChildren(prefix, jobKey, options)
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
local prev = removeJobFromAnyState(prefix, jobId)
|
|
87
|
+
removeDeduplicationKeyIfNeededOnRemoval(prefix, jobKey, jobId)
|
|
88
|
+
if removeJobKeys(jobKey) > 0 then
|
|
89
|
+
local metaKey = prefix .. "meta"
|
|
90
|
+
local maxEvents = getOrSetMaxEvents(metaKey)
|
|
91
|
+
rcall("XADD", prefix .. "events", "MAXLEN", "~", maxEvents, "*", "event", "removed",
|
|
92
|
+
"jobId", jobId, "prev", prev)
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
end
|
|
@@ -3,14 +3,20 @@
|
|
|
3
3
|
]]
|
|
4
4
|
|
|
5
5
|
-- Includes
|
|
6
|
+
--- @include "filterOutJobsToIgnore"
|
|
6
7
|
--- @include "removeJobs"
|
|
7
8
|
|
|
8
9
|
local function getListItems(keyName, max)
|
|
9
10
|
return rcall('LRANGE', keyName, 0, max - 1)
|
|
10
11
|
end
|
|
11
12
|
|
|
12
|
-
local function removeListJobs(keyName, hard, baseKey, max)
|
|
13
|
+
local function removeListJobs(keyName, hard, baseKey, max, jobsToIgnore)
|
|
13
14
|
local jobs = getListItems(keyName, max)
|
|
15
|
+
|
|
16
|
+
if jobsToIgnore then
|
|
17
|
+
jobs = filterOutJobsToIgnore(jobs, jobsToIgnore)
|
|
18
|
+
end
|
|
19
|
+
|
|
14
20
|
local count = removeJobs(jobs, hard, baseKey, max)
|
|
15
21
|
rcall("LTRIM", keyName, #jobs, -1)
|
|
16
22
|
return count
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
--- @include "getTargetQueueList"
|
|
11
11
|
--- @include "removeJobKeys"
|
|
12
12
|
|
|
13
|
-
local function
|
|
13
|
+
local function _moveParentToWait(parentPrefix, parentId, emitEvent)
|
|
14
14
|
local parentTarget, isPausedOrMaxed = getTargetQueueList(parentPrefix .. "meta", parentPrefix .. "active",
|
|
15
15
|
parentPrefix .. "wait", parentPrefix .. "paused")
|
|
16
16
|
addJobInTargetList(parentTarget, parentPrefix .. "marker", "RPUSH", isPausedOrMaxed, parentId)
|
|
@@ -42,10 +42,10 @@ local function removeParentDependencyKey(jobKey, hard, parentKey, baseKey, debou
|
|
|
42
42
|
rcall("DEL", parentPrefix .. "de:" .. debounceId)
|
|
43
43
|
end
|
|
44
44
|
else
|
|
45
|
-
|
|
45
|
+
_moveParentToWait(parentPrefix, parentId)
|
|
46
46
|
end
|
|
47
47
|
else
|
|
48
|
-
|
|
48
|
+
_moveParentToWait(parentPrefix, parentId, true)
|
|
49
49
|
end
|
|
50
50
|
end
|
|
51
51
|
end
|
|
@@ -75,10 +75,10 @@ local function removeParentDependencyKey(jobKey, hard, parentKey, baseKey, debou
|
|
|
75
75
|
rcall("DEL", parentPrefix .. "de:" .. parentAttributes[2])
|
|
76
76
|
end
|
|
77
77
|
else
|
|
78
|
-
|
|
78
|
+
_moveParentToWait(parentPrefix, parentId)
|
|
79
79
|
end
|
|
80
80
|
else
|
|
81
|
-
|
|
81
|
+
_moveParentToWait(parentPrefix, parentId, true)
|
|
82
82
|
end
|
|
83
83
|
end
|
|
84
84
|
end
|