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