@tachybase/plugin-adapter-bullmq 1.3.17 → 1.3.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (347) hide show
  1. package/dist/externalVersion.js +2 -2
  2. package/dist/node_modules/@bull-board/api/dist/src/handlers/error.d.ts +4 -2
  3. package/dist/node_modules/@bull-board/api/dist/src/handlers/error.js +2 -2
  4. package/dist/node_modules/@bull-board/api/dist/src/handlers/pauseAll.d.ts +4 -0
  5. package/dist/node_modules/@bull-board/api/dist/src/handlers/pauseAll.js +15 -0
  6. package/dist/node_modules/@bull-board/api/dist/src/handlers/queues.js +4 -0
  7. package/dist/node_modules/@bull-board/api/dist/src/handlers/resumeAll.d.ts +4 -0
  8. package/dist/node_modules/@bull-board/api/dist/src/handlers/resumeAll.js +15 -0
  9. package/dist/node_modules/@bull-board/api/dist/src/index.js +1 -1
  10. package/dist/node_modules/@bull-board/api/dist/src/queueAdapters/base.d.ts +4 -0
  11. package/dist/node_modules/@bull-board/api/dist/src/queueAdapters/base.js +6 -0
  12. package/dist/node_modules/@bull-board/api/dist/src/queueAdapters/bull.js +6 -4
  13. package/dist/node_modules/@bull-board/api/dist/src/routes.js +4 -0
  14. package/dist/node_modules/@bull-board/api/dist/typings/app.d.ts +22 -2
  15. package/dist/node_modules/@bull-board/api/package.json +1 -1
  16. package/dist/node_modules/@bull-board/koa/dist/KoaAdapter.js +1 -1
  17. package/dist/node_modules/@bull-board/koa/dist/index.js +101 -101
  18. package/dist/node_modules/@bull-board/koa/package.json +1 -1
  19. package/dist/node_modules/bullmq/dist/cjs/classes/backoffs.js +18 -5
  20. package/dist/node_modules/bullmq/dist/cjs/classes/child-pool.js +7 -2
  21. package/dist/node_modules/bullmq/dist/cjs/classes/child-processor.js +59 -5
  22. package/dist/node_modules/bullmq/dist/cjs/classes/child.js +3 -1
  23. package/dist/node_modules/bullmq/dist/cjs/classes/errors/index.js +2 -1
  24. package/dist/node_modules/bullmq/dist/cjs/classes/errors/waiting-error.js +19 -0
  25. package/dist/node_modules/bullmq/dist/cjs/classes/flow-producer.js +21 -5
  26. package/dist/node_modules/bullmq/dist/cjs/classes/index.js +1 -0
  27. package/dist/node_modules/bullmq/dist/cjs/classes/job-scheduler.js +88 -62
  28. package/dist/node_modules/bullmq/dist/cjs/classes/job.js +216 -109
  29. package/dist/node_modules/bullmq/dist/cjs/classes/main-base.js +1 -1
  30. package/dist/node_modules/bullmq/dist/cjs/classes/queue-base.js +10 -9
  31. package/dist/node_modules/bullmq/dist/cjs/classes/queue-getters.js +34 -14
  32. package/dist/node_modules/bullmq/dist/cjs/classes/queue.js +19 -13
  33. package/dist/node_modules/bullmq/dist/cjs/classes/redis-connection.js +16 -9
  34. package/dist/node_modules/bullmq/dist/cjs/classes/repeat.js +1 -1
  35. package/dist/node_modules/bullmq/dist/cjs/classes/sandbox.js +54 -28
  36. package/dist/node_modules/bullmq/dist/cjs/classes/scripts.js +141 -39
  37. package/dist/node_modules/bullmq/dist/cjs/classes/worker.js +191 -182
  38. package/dist/node_modules/bullmq/dist/cjs/commands/addDelayedJob-6.lua +6 -17
  39. package/dist/node_modules/bullmq/dist/cjs/commands/addJobScheduler-11.lua +123 -0
  40. package/dist/node_modules/bullmq/dist/{esm/commands/addParentJob-4.lua → cjs/commands/addParentJob-5.lua} +7 -6
  41. package/dist/node_modules/bullmq/dist/cjs/commands/{addPrioritizedJob-8.lua → addPrioritizedJob-9.lua} +11 -10
  42. package/dist/node_modules/bullmq/dist/cjs/commands/addRepeatableJob-2.lua +2 -2
  43. package/dist/node_modules/bullmq/dist/{esm/commands/addStandardJob-8.lua → cjs/commands/addStandardJob-9.lua} +9 -8
  44. package/dist/node_modules/bullmq/dist/cjs/commands/cleanJobsInSet-3.lua +9 -5
  45. package/dist/node_modules/bullmq/dist/cjs/commands/drain-5.lua +16 -16
  46. package/dist/node_modules/bullmq/dist/cjs/commands/getDependencyCounts-4.lua +31 -0
  47. package/dist/node_modules/bullmq/dist/cjs/commands/getState-8.lua +5 -5
  48. package/dist/node_modules/bullmq/dist/cjs/commands/getStateV2-8.lua +8 -8
  49. package/dist/node_modules/bullmq/dist/cjs/commands/includes/addDelayedJob.lua +23 -0
  50. package/dist/node_modules/bullmq/dist/cjs/commands/includes/addJobFromScheduler.lua +37 -0
  51. package/dist/node_modules/bullmq/dist/cjs/commands/includes/addJobWithPriority.lua +2 -2
  52. package/dist/node_modules/bullmq/dist/cjs/commands/includes/cleanList.lua +4 -2
  53. package/dist/node_modules/bullmq/dist/cjs/commands/includes/cleanSet.lua +3 -11
  54. package/dist/node_modules/bullmq/dist/cjs/commands/includes/collectMetrics.lua +1 -1
  55. package/dist/node_modules/bullmq/dist/cjs/commands/includes/deduplicateJob.lua +63 -18
  56. package/dist/node_modules/bullmq/dist/cjs/commands/includes/filterOutJobsToIgnore.lua +14 -0
  57. package/dist/node_modules/bullmq/dist/cjs/commands/includes/getNextDelayedTimestamp.lua +1 -1
  58. package/dist/node_modules/bullmq/dist/cjs/commands/includes/getOrSetMaxEvents.lua +6 -6
  59. package/dist/node_modules/bullmq/dist/cjs/commands/includes/getPriorityScore.lua +8 -0
  60. package/dist/node_modules/bullmq/dist/cjs/commands/includes/isJobSchedulerJob.lua +15 -0
  61. package/dist/node_modules/bullmq/dist/cjs/commands/includes/isLocked.lua +1 -0
  62. package/dist/node_modules/bullmq/dist/cjs/commands/includes/moveChildFromDependenciesIfNeeded.lua +77 -0
  63. package/dist/node_modules/bullmq/dist/cjs/commands/includes/{moveJobFromPriorityToActive.lua → moveJobFromPrioritizedToActive.lua} +1 -1
  64. package/dist/node_modules/bullmq/dist/cjs/commands/includes/moveParentToWait.lua +45 -0
  65. package/dist/node_modules/bullmq/dist/cjs/commands/includes/moveParentToWaitIfNeeded.lua +9 -50
  66. package/dist/node_modules/bullmq/dist/cjs/commands/includes/moveParentToWaitIfNoPendingDependencies.lua +13 -0
  67. package/dist/node_modules/bullmq/dist/cjs/commands/includes/prepareJobForProcessing.lua +2 -1
  68. package/dist/node_modules/bullmq/dist/cjs/commands/includes/promoteDelayedJobs.lua +7 -3
  69. package/dist/node_modules/bullmq/dist/cjs/commands/includes/removeDeduplicationKeyIfNeededOnFinalization.lua +23 -0
  70. package/dist/node_modules/bullmq/dist/cjs/commands/includes/removeDeduplicationKeyIfNeededOnRemoval.lua +16 -0
  71. package/dist/node_modules/bullmq/dist/cjs/commands/includes/removeJob.lua +2 -2
  72. package/dist/node_modules/bullmq/dist/cjs/commands/includes/removeJobKeys.lua +2 -2
  73. package/dist/node_modules/bullmq/dist/cjs/commands/includes/removeJobWithChildren.lua +95 -0
  74. package/dist/node_modules/bullmq/dist/cjs/commands/includes/removeListJobs.lua +7 -1
  75. package/dist/node_modules/bullmq/dist/cjs/commands/includes/removeParentDependencyKey.lua +5 -5
  76. package/dist/node_modules/bullmq/dist/cjs/commands/includes/removeZSetJobs.lua +2 -8
  77. package/dist/node_modules/bullmq/dist/cjs/commands/includes/storeJob.lua +2 -2
  78. package/dist/node_modules/bullmq/dist/cjs/commands/includes/storeJobScheduler.lua +52 -0
  79. package/dist/node_modules/bullmq/dist/cjs/commands/includes/trimEvents.lua +1 -1
  80. package/dist/node_modules/bullmq/dist/cjs/commands/includes/updateExistingJobsParent.lua +1 -1
  81. package/dist/node_modules/bullmq/dist/cjs/commands/includes/updateJobFields.lua +5 -5
  82. package/dist/node_modules/bullmq/dist/cjs/commands/includes/updateParentDepsIfNeeded.lua +2 -2
  83. package/dist/node_modules/bullmq/dist/cjs/commands/isFinished-3.lua +2 -2
  84. package/dist/node_modules/bullmq/dist/cjs/commands/moveJobFromActiveToWait-9.lua +63 -0
  85. package/dist/node_modules/bullmq/dist/cjs/commands/moveStalledJobsToWait-8.lua +109 -0
  86. package/dist/node_modules/bullmq/dist/cjs/commands/moveToActive-11.lua +3 -2
  87. package/dist/node_modules/bullmq/dist/cjs/commands/moveToFinished-14.lua +52 -52
  88. package/dist/node_modules/bullmq/dist/cjs/commands/moveToWaitingChildren-8.lua +106 -0
  89. package/dist/node_modules/bullmq/dist/cjs/commands/removeJob-2.lua +18 -66
  90. package/dist/node_modules/bullmq/dist/cjs/commands/removeJobScheduler-3.lua +1 -1
  91. package/dist/node_modules/bullmq/dist/cjs/commands/removeUnprocessedChildren-2.lua +31 -0
  92. package/dist/node_modules/bullmq/dist/cjs/commands/retryJob-11.lua +11 -5
  93. package/dist/node_modules/bullmq/dist/cjs/commands/updateJobScheduler-12.lua +90 -0
  94. package/dist/node_modules/bullmq/dist/cjs/commands/updateRepeatableJobMillis-1.lua +1 -1
  95. package/dist/node_modules/bullmq/dist/cjs/enums/child-command.js +2 -0
  96. package/dist/node_modules/bullmq/dist/cjs/enums/error-code.js +2 -1
  97. package/dist/node_modules/bullmq/dist/cjs/enums/parent-command.js +5 -2
  98. package/dist/node_modules/bullmq/dist/cjs/index.js +1 -1
  99. package/dist/node_modules/bullmq/dist/cjs/interfaces/index.js +2 -1
  100. package/dist/node_modules/bullmq/dist/cjs/interfaces/{debounce-options.js → parent-options.js} +1 -1
  101. package/dist/node_modules/bullmq/dist/cjs/interfaces/receiver.js +3 -0
  102. package/dist/node_modules/bullmq/dist/cjs/scripts/addDelayedJob-6.js +163 -84
  103. package/dist/node_modules/bullmq/dist/cjs/scripts/addJobScheduler-11.js +465 -0
  104. package/dist/node_modules/bullmq/dist/cjs/scripts/{addParentJob-4.js → addParentJob-5.js} +147 -75
  105. package/dist/node_modules/bullmq/dist/cjs/scripts/{addPrioritizedJob-8.js → addPrioritizedJob-9.js} +151 -79
  106. package/dist/node_modules/bullmq/dist/cjs/scripts/addRepeatableJob-2.js +18 -13
  107. package/dist/node_modules/bullmq/dist/cjs/scripts/{addStandardJob-8.js → addStandardJob-9.js} +149 -77
  108. package/dist/node_modules/bullmq/dist/cjs/scripts/changeDelay-4.js +7 -7
  109. package/dist/node_modules/bullmq/dist/cjs/scripts/changePriority-7.js +8 -2
  110. package/dist/node_modules/bullmq/dist/cjs/scripts/cleanJobsInSet-3.js +45 -29
  111. package/dist/node_modules/bullmq/dist/cjs/scripts/drain-5.js +49 -35
  112. package/dist/node_modules/bullmq/dist/cjs/scripts/getDependencyCounts-4.js +37 -0
  113. package/dist/node_modules/bullmq/dist/cjs/scripts/getState-8.js +5 -5
  114. package/dist/node_modules/bullmq/dist/cjs/scripts/getStateV2-8.js +8 -8
  115. package/dist/node_modules/bullmq/dist/cjs/scripts/index.js +10 -7
  116. package/dist/node_modules/bullmq/dist/cjs/scripts/isFinished-3.js +2 -2
  117. package/dist/node_modules/bullmq/dist/cjs/scripts/{moveJobFromActiveToWait-10.js → moveJobFromActiveToWait-9.js} +57 -37
  118. package/dist/node_modules/bullmq/dist/cjs/scripts/moveJobsToWait-8.js +6 -6
  119. package/dist/node_modules/bullmq/dist/cjs/scripts/moveStalledJobsToWait-8.js +171 -0
  120. package/dist/node_modules/bullmq/dist/cjs/scripts/moveToActive-11.js +18 -8
  121. package/dist/node_modules/bullmq/dist/cjs/scripts/moveToDelayed-8.js +12 -12
  122. package/dist/node_modules/bullmq/dist/cjs/scripts/moveToFinished-14.js +218 -155
  123. package/dist/node_modules/bullmq/dist/cjs/scripts/moveToWaitingChildren-8.js +529 -0
  124. package/dist/node_modules/bullmq/dist/cjs/scripts/obliterate-2.js +33 -20
  125. package/dist/node_modules/bullmq/dist/cjs/scripts/pause-7.js +1 -1
  126. package/dist/node_modules/bullmq/dist/cjs/scripts/promote-9.js +8 -2
  127. package/dist/node_modules/bullmq/dist/cjs/scripts/removeChildDependency-1.js +7 -7
  128. package/dist/node_modules/bullmq/dist/cjs/scripts/removeJob-2.js +120 -63
  129. package/dist/node_modules/bullmq/dist/cjs/scripts/removeJobScheduler-3.js +3 -3
  130. package/dist/node_modules/bullmq/dist/cjs/scripts/removeRepeatable-3.js +2 -2
  131. package/dist/node_modules/bullmq/dist/cjs/scripts/removeUnprocessedChildren-2.js +339 -0
  132. package/dist/node_modules/bullmq/dist/cjs/scripts/reprocessJob-8.js +6 -6
  133. package/dist/node_modules/bullmq/dist/cjs/scripts/retryJob-11.js +47 -26
  134. package/dist/node_modules/bullmq/dist/cjs/scripts/updateJobScheduler-12.js +274 -0
  135. package/dist/node_modules/bullmq/dist/cjs/scripts/updateProgress-3.js +6 -6
  136. package/dist/node_modules/bullmq/dist/cjs/scripts/updateRepeatableJobMillis-1.js +1 -1
  137. package/dist/node_modules/bullmq/dist/cjs/tsconfig-cjs.tsbuildinfo +1 -1
  138. package/dist/node_modules/bullmq/dist/cjs/types/deduplication-options.js +3 -0
  139. package/dist/node_modules/bullmq/dist/cjs/types/index.js +3 -0
  140. package/dist/node_modules/bullmq/dist/cjs/types/job-progress.js +3 -0
  141. package/dist/node_modules/bullmq/dist/cjs/types/script-queue-context.js +3 -0
  142. package/dist/node_modules/bullmq/dist/cjs/utils.js +29 -1
  143. package/dist/node_modules/bullmq/dist/cjs/version.js +1 -1
  144. package/dist/node_modules/bullmq/dist/esm/classes/backoffs.d.ts +1 -1
  145. package/dist/node_modules/bullmq/dist/esm/classes/backoffs.js +18 -5
  146. package/dist/node_modules/bullmq/dist/esm/classes/child-pool.d.ts +1 -1
  147. package/dist/node_modules/bullmq/dist/esm/classes/child-pool.js +7 -2
  148. package/dist/node_modules/bullmq/dist/esm/classes/child-processor.d.ts +3 -2
  149. package/dist/node_modules/bullmq/dist/esm/classes/child-processor.js +59 -5
  150. package/dist/node_modules/bullmq/dist/esm/classes/child.js +3 -1
  151. package/dist/node_modules/bullmq/dist/esm/classes/errors/index.d.ts +2 -1
  152. package/dist/node_modules/bullmq/dist/esm/classes/errors/index.js +2 -1
  153. package/dist/node_modules/bullmq/dist/esm/classes/errors/waiting-error.d.ts +10 -0
  154. package/dist/node_modules/bullmq/dist/esm/classes/errors/waiting-error.js +15 -0
  155. package/dist/node_modules/bullmq/dist/esm/classes/flow-producer.d.ts +3 -9
  156. package/dist/node_modules/bullmq/dist/esm/classes/flow-producer.js +21 -5
  157. package/dist/node_modules/bullmq/dist/esm/classes/index.d.ts +1 -0
  158. package/dist/node_modules/bullmq/dist/esm/classes/index.js +1 -0
  159. package/dist/node_modules/bullmq/dist/esm/classes/job-scheduler.d.ts +2 -2
  160. package/dist/node_modules/bullmq/dist/esm/classes/job-scheduler.js +88 -62
  161. package/dist/node_modules/bullmq/dist/esm/classes/job.d.ts +69 -19
  162. package/dist/node_modules/bullmq/dist/esm/classes/job.js +217 -110
  163. package/dist/node_modules/bullmq/dist/esm/classes/main-base.d.ts +2 -3
  164. package/dist/node_modules/bullmq/dist/esm/classes/main-base.js +1 -1
  165. package/dist/node_modules/bullmq/dist/esm/classes/queue-base.d.ts +2 -5
  166. package/dist/node_modules/bullmq/dist/esm/classes/queue-base.js +11 -10
  167. package/dist/node_modules/bullmq/dist/esm/classes/queue-events-producer.d.ts +2 -2
  168. package/dist/node_modules/bullmq/dist/esm/classes/queue-events.d.ts +118 -29
  169. package/dist/node_modules/bullmq/dist/esm/classes/queue-getters.d.ts +20 -13
  170. package/dist/node_modules/bullmq/dist/esm/classes/queue-getters.js +34 -14
  171. package/dist/node_modules/bullmq/dist/esm/classes/queue.d.ts +19 -16
  172. package/dist/node_modules/bullmq/dist/esm/classes/queue.js +19 -13
  173. package/dist/node_modules/bullmq/dist/esm/classes/redis-connection.d.ts +7 -3
  174. package/dist/node_modules/bullmq/dist/esm/classes/redis-connection.js +16 -9
  175. package/dist/node_modules/bullmq/dist/esm/classes/repeat.js +1 -1
  176. package/dist/node_modules/bullmq/dist/esm/classes/sandbox.js +54 -28
  177. package/dist/node_modules/bullmq/dist/esm/classes/scripts.d.ts +20 -13
  178. package/dist/node_modules/bullmq/dist/esm/classes/scripts.js +141 -39
  179. package/dist/node_modules/bullmq/dist/esm/classes/worker.d.ts +28 -7
  180. package/dist/node_modules/bullmq/dist/esm/classes/worker.js +192 -183
  181. package/dist/node_modules/bullmq/dist/esm/commands/addDelayedJob-6.lua +6 -17
  182. package/dist/node_modules/bullmq/dist/esm/commands/addJobScheduler-11.lua +123 -0
  183. package/dist/node_modules/bullmq/dist/{cjs/commands/addParentJob-4.lua → esm/commands/addParentJob-5.lua} +7 -6
  184. package/dist/node_modules/bullmq/dist/esm/commands/{addPrioritizedJob-8.lua → addPrioritizedJob-9.lua} +11 -10
  185. package/dist/node_modules/bullmq/dist/esm/commands/addRepeatableJob-2.lua +2 -2
  186. package/dist/node_modules/bullmq/dist/{cjs/commands/addStandardJob-8.lua → esm/commands/addStandardJob-9.lua} +9 -8
  187. package/dist/node_modules/bullmq/dist/esm/commands/cleanJobsInSet-3.lua +9 -5
  188. package/dist/node_modules/bullmq/dist/esm/commands/drain-5.lua +16 -16
  189. package/dist/node_modules/bullmq/dist/esm/commands/getDependencyCounts-4.lua +31 -0
  190. package/dist/node_modules/bullmq/dist/esm/commands/getState-8.lua +5 -5
  191. package/dist/node_modules/bullmq/dist/esm/commands/getStateV2-8.lua +8 -8
  192. package/dist/node_modules/bullmq/dist/esm/commands/includes/addDelayedJob.lua +23 -0
  193. package/dist/node_modules/bullmq/dist/esm/commands/includes/addJobFromScheduler.lua +37 -0
  194. package/dist/node_modules/bullmq/dist/esm/commands/includes/addJobWithPriority.lua +2 -2
  195. package/dist/node_modules/bullmq/dist/esm/commands/includes/cleanList.lua +4 -2
  196. package/dist/node_modules/bullmq/dist/esm/commands/includes/cleanSet.lua +3 -11
  197. package/dist/node_modules/bullmq/dist/esm/commands/includes/collectMetrics.lua +1 -1
  198. package/dist/node_modules/bullmq/dist/esm/commands/includes/deduplicateJob.lua +63 -18
  199. package/dist/node_modules/bullmq/dist/esm/commands/includes/filterOutJobsToIgnore.lua +14 -0
  200. package/dist/node_modules/bullmq/dist/esm/commands/includes/getNextDelayedTimestamp.lua +1 -1
  201. package/dist/node_modules/bullmq/dist/esm/commands/includes/getOrSetMaxEvents.lua +6 -6
  202. package/dist/node_modules/bullmq/dist/esm/commands/includes/getPriorityScore.lua +8 -0
  203. package/dist/node_modules/bullmq/dist/esm/commands/includes/isJobSchedulerJob.lua +15 -0
  204. package/dist/node_modules/bullmq/dist/esm/commands/includes/isLocked.lua +1 -0
  205. package/dist/node_modules/bullmq/dist/esm/commands/includes/moveChildFromDependenciesIfNeeded.lua +77 -0
  206. package/dist/node_modules/bullmq/dist/esm/commands/includes/{moveJobFromPriorityToActive.lua → moveJobFromPrioritizedToActive.lua} +1 -1
  207. package/dist/node_modules/bullmq/dist/esm/commands/includes/moveParentToWait.lua +45 -0
  208. package/dist/node_modules/bullmq/dist/esm/commands/includes/moveParentToWaitIfNeeded.lua +9 -50
  209. package/dist/node_modules/bullmq/dist/esm/commands/includes/moveParentToWaitIfNoPendingDependencies.lua +13 -0
  210. package/dist/node_modules/bullmq/dist/esm/commands/includes/prepareJobForProcessing.lua +2 -1
  211. package/dist/node_modules/bullmq/dist/esm/commands/includes/promoteDelayedJobs.lua +7 -3
  212. package/dist/node_modules/bullmq/dist/esm/commands/includes/removeDeduplicationKeyIfNeededOnFinalization.lua +23 -0
  213. package/dist/node_modules/bullmq/dist/esm/commands/includes/removeDeduplicationKeyIfNeededOnRemoval.lua +16 -0
  214. package/dist/node_modules/bullmq/dist/esm/commands/includes/removeJob.lua +2 -2
  215. package/dist/node_modules/bullmq/dist/esm/commands/includes/removeJobKeys.lua +2 -2
  216. package/dist/node_modules/bullmq/dist/esm/commands/includes/removeJobWithChildren.lua +95 -0
  217. package/dist/node_modules/bullmq/dist/esm/commands/includes/removeListJobs.lua +7 -1
  218. package/dist/node_modules/bullmq/dist/esm/commands/includes/removeParentDependencyKey.lua +5 -5
  219. package/dist/node_modules/bullmq/dist/esm/commands/includes/removeZSetJobs.lua +2 -8
  220. package/dist/node_modules/bullmq/dist/esm/commands/includes/storeJob.lua +2 -2
  221. package/dist/node_modules/bullmq/dist/esm/commands/includes/storeJobScheduler.lua +52 -0
  222. package/dist/node_modules/bullmq/dist/esm/commands/includes/trimEvents.lua +1 -1
  223. package/dist/node_modules/bullmq/dist/esm/commands/includes/updateExistingJobsParent.lua +1 -1
  224. package/dist/node_modules/bullmq/dist/esm/commands/includes/updateJobFields.lua +5 -5
  225. package/dist/node_modules/bullmq/dist/esm/commands/includes/updateParentDepsIfNeeded.lua +2 -2
  226. package/dist/node_modules/bullmq/dist/esm/commands/isFinished-3.lua +2 -2
  227. package/dist/node_modules/bullmq/dist/esm/commands/moveJobFromActiveToWait-9.lua +63 -0
  228. package/dist/node_modules/bullmq/dist/esm/commands/moveStalledJobsToWait-8.lua +109 -0
  229. package/dist/node_modules/bullmq/dist/esm/commands/moveToActive-11.lua +3 -2
  230. package/dist/node_modules/bullmq/dist/esm/commands/moveToFinished-14.lua +52 -52
  231. package/dist/node_modules/bullmq/dist/esm/commands/moveToWaitingChildren-8.lua +106 -0
  232. package/dist/node_modules/bullmq/dist/esm/commands/removeJob-2.lua +18 -66
  233. package/dist/node_modules/bullmq/dist/esm/commands/removeJobScheduler-3.lua +1 -1
  234. package/dist/node_modules/bullmq/dist/esm/commands/removeUnprocessedChildren-2.lua +31 -0
  235. package/dist/node_modules/bullmq/dist/esm/commands/retryJob-11.lua +11 -5
  236. package/dist/node_modules/bullmq/dist/esm/commands/updateJobScheduler-12.lua +90 -0
  237. package/dist/node_modules/bullmq/dist/esm/commands/updateRepeatableJobMillis-1.lua +1 -1
  238. package/dist/node_modules/bullmq/dist/esm/enums/child-command.d.ts +3 -1
  239. package/dist/node_modules/bullmq/dist/esm/enums/child-command.js +2 -0
  240. package/dist/node_modules/bullmq/dist/esm/enums/error-code.d.ts +3 -2
  241. package/dist/node_modules/bullmq/dist/esm/enums/error-code.js +2 -1
  242. package/dist/node_modules/bullmq/dist/esm/enums/parent-command.d.ts +5 -2
  243. package/dist/node_modules/bullmq/dist/esm/enums/parent-command.js +5 -2
  244. package/dist/node_modules/bullmq/dist/esm/interfaces/backoff-options.d.ts +5 -0
  245. package/dist/node_modules/bullmq/dist/esm/interfaces/base-job-options.d.ts +3 -9
  246. package/dist/node_modules/bullmq/dist/esm/interfaces/child-message.d.ts +1 -0
  247. package/dist/node_modules/bullmq/dist/esm/interfaces/index.d.ts +2 -1
  248. package/dist/node_modules/bullmq/dist/esm/interfaces/index.js +2 -1
  249. package/dist/node_modules/bullmq/dist/esm/interfaces/job-json.d.ts +6 -2
  250. package/dist/node_modules/bullmq/dist/esm/interfaces/job-scheduler-json.d.ts +7 -4
  251. package/dist/node_modules/bullmq/dist/esm/interfaces/minimal-job.d.ts +34 -15
  252. package/dist/node_modules/bullmq/dist/esm/interfaces/parent-options.d.ts +11 -0
  253. package/dist/node_modules/bullmq/dist/esm/interfaces/parent-options.js +2 -0
  254. package/dist/node_modules/bullmq/dist/esm/interfaces/parent.d.ts +6 -2
  255. package/dist/node_modules/bullmq/dist/esm/interfaces/queue-options.d.ts +15 -6
  256. package/dist/node_modules/bullmq/dist/esm/interfaces/receiver.d.ts +4 -0
  257. package/dist/node_modules/bullmq/dist/esm/interfaces/receiver.js +2 -0
  258. package/dist/node_modules/bullmq/dist/esm/interfaces/repeat-options.d.ts +1 -2
  259. package/dist/node_modules/bullmq/dist/esm/interfaces/repeatable-options.d.ts +2 -0
  260. package/dist/node_modules/bullmq/dist/esm/interfaces/sandboxed-job.d.ts +3 -2
  261. package/dist/node_modules/bullmq/dist/esm/interfaces/sandboxed-options.d.ts +1 -1
  262. package/dist/node_modules/bullmq/dist/esm/interfaces/telemetry.d.ts +18 -15
  263. package/dist/node_modules/bullmq/dist/esm/interfaces/worker-options.d.ts +10 -10
  264. package/dist/node_modules/bullmq/dist/esm/scripts/addDelayedJob-6.js +163 -84
  265. package/dist/node_modules/bullmq/dist/esm/scripts/addJobScheduler-11.js +462 -0
  266. package/dist/node_modules/bullmq/dist/esm/scripts/{addParentJob-4.js → addParentJob-5.js} +147 -75
  267. package/dist/node_modules/bullmq/dist/esm/scripts/{addPrioritizedJob-8.js → addPrioritizedJob-9.js} +151 -79
  268. package/dist/node_modules/bullmq/dist/esm/scripts/addRepeatableJob-2.js +18 -13
  269. package/dist/node_modules/bullmq/dist/esm/scripts/{addStandardJob-8.js → addStandardJob-9.js} +149 -77
  270. package/dist/node_modules/bullmq/dist/esm/scripts/changeDelay-4.js +7 -7
  271. package/dist/node_modules/bullmq/dist/esm/scripts/changePriority-7.js +8 -2
  272. package/dist/node_modules/bullmq/dist/esm/scripts/cleanJobsInSet-3.js +45 -29
  273. package/dist/node_modules/bullmq/dist/esm/scripts/drain-5.js +49 -35
  274. package/dist/node_modules/bullmq/dist/esm/scripts/getDependencyCounts-4.d.ts +5 -0
  275. package/dist/node_modules/bullmq/dist/esm/scripts/getDependencyCounts-4.js +34 -0
  276. package/dist/node_modules/bullmq/dist/esm/scripts/getState-8.js +5 -5
  277. package/dist/node_modules/bullmq/dist/esm/scripts/getStateV2-8.js +8 -8
  278. package/dist/node_modules/bullmq/dist/esm/scripts/index.d.ts +10 -7
  279. package/dist/node_modules/bullmq/dist/esm/scripts/index.js +10 -7
  280. package/dist/node_modules/bullmq/dist/esm/scripts/isFinished-3.js +2 -2
  281. package/dist/node_modules/bullmq/dist/esm/scripts/{moveJobFromActiveToWait-10.js → moveJobFromActiveToWait-9.js} +57 -37
  282. package/dist/node_modules/bullmq/dist/esm/scripts/moveJobsToWait-8.js +6 -6
  283. package/dist/node_modules/bullmq/dist/esm/scripts/moveStalledJobsToWait-8.js +168 -0
  284. package/dist/node_modules/bullmq/dist/esm/scripts/moveToActive-11.js +18 -8
  285. package/dist/node_modules/bullmq/dist/esm/scripts/moveToDelayed-8.js +12 -12
  286. package/dist/node_modules/bullmq/dist/esm/scripts/moveToFinished-14.js +218 -155
  287. package/dist/node_modules/bullmq/dist/esm/scripts/moveToWaitingChildren-8.js +526 -0
  288. package/dist/node_modules/bullmq/dist/esm/scripts/obliterate-2.js +33 -20
  289. package/dist/node_modules/bullmq/dist/esm/scripts/pause-7.js +1 -1
  290. package/dist/node_modules/bullmq/dist/esm/scripts/promote-9.js +8 -2
  291. package/dist/node_modules/bullmq/dist/esm/scripts/removeChildDependency-1.js +7 -7
  292. package/dist/node_modules/bullmq/dist/esm/scripts/removeJob-2.js +120 -63
  293. package/dist/node_modules/bullmq/dist/esm/scripts/removeJobScheduler-3.js +3 -3
  294. package/dist/node_modules/bullmq/dist/esm/scripts/removeRepeatable-3.js +2 -2
  295. package/dist/node_modules/bullmq/dist/esm/scripts/removeUnprocessedChildren-2.d.ts +5 -0
  296. package/dist/node_modules/bullmq/dist/esm/scripts/removeUnprocessedChildren-2.js +336 -0
  297. package/dist/node_modules/bullmq/dist/esm/scripts/reprocessJob-8.js +6 -6
  298. package/dist/node_modules/bullmq/dist/esm/scripts/retryJob-11.js +47 -26
  299. package/dist/node_modules/bullmq/dist/esm/scripts/updateJobScheduler-12.d.ts +5 -0
  300. package/dist/node_modules/bullmq/dist/esm/scripts/updateJobScheduler-12.js +271 -0
  301. package/dist/node_modules/bullmq/dist/esm/scripts/updateProgress-3.js +6 -6
  302. package/dist/node_modules/bullmq/dist/esm/scripts/updateRepeatableJobMillis-1.js +1 -1
  303. package/dist/node_modules/bullmq/dist/esm/tsconfig.tsbuildinfo +1 -1
  304. package/dist/node_modules/bullmq/dist/esm/types/deduplication-options.d.ts +22 -0
  305. package/dist/node_modules/bullmq/dist/esm/types/deduplication-options.js +2 -0
  306. package/dist/node_modules/bullmq/dist/esm/types/index.d.ts +3 -0
  307. package/dist/node_modules/bullmq/dist/esm/types/index.js +3 -0
  308. package/dist/node_modules/bullmq/dist/esm/types/job-options.d.ts +19 -8
  309. package/dist/node_modules/bullmq/dist/esm/types/job-progress.d.ts +1 -0
  310. package/dist/node_modules/bullmq/dist/esm/types/job-progress.js +2 -0
  311. package/dist/node_modules/bullmq/dist/esm/types/script-queue-context.d.ts +2 -0
  312. package/dist/node_modules/bullmq/dist/esm/types/script-queue-context.js +2 -0
  313. package/dist/node_modules/bullmq/dist/esm/utils.d.ts +25 -5
  314. package/dist/node_modules/bullmq/dist/esm/utils.js +27 -0
  315. package/dist/node_modules/bullmq/dist/esm/version.d.ts +1 -1
  316. package/dist/node_modules/bullmq/dist/esm/version.js +1 -1
  317. package/dist/node_modules/bullmq/package.json +1 -1
  318. package/package.json +7 -7
  319. package/dist/node_modules/bullmq/dist/cjs/commands/addJobScheduler-2.lua +0 -91
  320. package/dist/node_modules/bullmq/dist/cjs/commands/includes/moveParentFromWaitingChildrenToFailed.lua +0 -53
  321. package/dist/node_modules/bullmq/dist/cjs/commands/includes/removeDeduplicationKey.lua +0 -11
  322. package/dist/node_modules/bullmq/dist/cjs/commands/includes/removeDeduplicationKeyIfNeeded.lua +0 -14
  323. package/dist/node_modules/bullmq/dist/cjs/commands/moveJobFromActiveToWait-10.lua +0 -60
  324. package/dist/node_modules/bullmq/dist/cjs/commands/moveStalledJobsToWait-9.lua +0 -156
  325. package/dist/node_modules/bullmq/dist/cjs/commands/moveToWaitingChildren-5.lua +0 -68
  326. package/dist/node_modules/bullmq/dist/cjs/scripts/addJobScheduler-2.js +0 -237
  327. package/dist/node_modules/bullmq/dist/cjs/scripts/moveStalledJobsToWait-9.js +0 -529
  328. package/dist/node_modules/bullmq/dist/cjs/scripts/moveToWaitingChildren-5.js +0 -83
  329. package/dist/node_modules/bullmq/dist/esm/commands/addJobScheduler-2.lua +0 -91
  330. package/dist/node_modules/bullmq/dist/esm/commands/includes/moveParentFromWaitingChildrenToFailed.lua +0 -53
  331. package/dist/node_modules/bullmq/dist/esm/commands/includes/removeDeduplicationKey.lua +0 -11
  332. package/dist/node_modules/bullmq/dist/esm/commands/includes/removeDeduplicationKeyIfNeeded.lua +0 -14
  333. package/dist/node_modules/bullmq/dist/esm/commands/moveJobFromActiveToWait-10.lua +0 -60
  334. package/dist/node_modules/bullmq/dist/esm/commands/moveStalledJobsToWait-9.lua +0 -156
  335. package/dist/node_modules/bullmq/dist/esm/commands/moveToWaitingChildren-5.lua +0 -68
  336. package/dist/node_modules/bullmq/dist/esm/interfaces/debounce-options.d.ts +0 -13
  337. package/dist/node_modules/bullmq/dist/esm/interfaces/debounce-options.js +0 -2
  338. package/dist/node_modules/bullmq/dist/esm/scripts/addJobScheduler-2.js +0 -234
  339. package/dist/node_modules/bullmq/dist/esm/scripts/moveStalledJobsToWait-9.js +0 -526
  340. package/dist/node_modules/bullmq/dist/esm/scripts/moveToWaitingChildren-5.js +0 -80
  341. /package/dist/node_modules/bullmq/dist/esm/scripts/{addJobScheduler-2.d.ts → addJobScheduler-11.d.ts} +0 -0
  342. /package/dist/node_modules/bullmq/dist/esm/scripts/{addParentJob-4.d.ts → addParentJob-5.d.ts} +0 -0
  343. /package/dist/node_modules/bullmq/dist/esm/scripts/{addPrioritizedJob-8.d.ts → addPrioritizedJob-9.d.ts} +0 -0
  344. /package/dist/node_modules/bullmq/dist/esm/scripts/{addStandardJob-8.d.ts → addStandardJob-9.d.ts} +0 -0
  345. /package/dist/node_modules/bullmq/dist/esm/scripts/{moveJobFromActiveToWait-10.d.ts → moveJobFromActiveToWait-9.d.ts} +0 -0
  346. /package/dist/node_modules/bullmq/dist/esm/scripts/{moveStalledJobsToWait-9.d.ts → moveStalledJobsToWait-8.d.ts} +0 -0
  347. /package/dist/node_modules/bullmq/dist/esm/scripts/{moveToWaitingChildren-5.d.ts → moveToWaitingChildren-8.d.ts} +0 -0
@@ -0,0 +1,106 @@
1
+ --[[
2
+ Moves job from active to waiting children set.
3
+
4
+ Input:
5
+ KEYS[1] active key
6
+ KEYS[2] wait-children key
7
+ KEYS[3] job key
8
+ KEYS[4] job dependencies key
9
+ KEYS[5] job unsuccessful key
10
+ KEYS[6] stalled key
11
+ KEYS[7] failed key
12
+ KEYS[8] events key
13
+
14
+ ARGV[1] token
15
+ ARGV[2] child key
16
+ ARGV[3] timestamp
17
+ ARGV[4] jobId
18
+ ARGV[5] prefix
19
+
20
+ Output:
21
+ 0 - OK
22
+ 1 - There are not pending dependencies.
23
+ -1 - Missing job.
24
+ -2 - Missing lock
25
+ -3 - Job not in active set
26
+ ]]
27
+ local rcall = redis.call
28
+ local activeKey = KEYS[1]
29
+ local waitingChildrenKey = KEYS[2]
30
+ local jobKey = KEYS[3]
31
+ local jobDependenciesKey = KEYS[4]
32
+ local jobUnsuccessfulKey = KEYS[5]
33
+ local stalledKey = KEYS[6]
34
+ local failedKey = KEYS[7]
35
+ local timestamp = ARGV[3]
36
+ local jobId = ARGV[4]
37
+
38
+ --- Includes
39
+ --- @include "includes/moveChildFromDependenciesIfNeeded"
40
+ --- @include "includes/removeDeduplicationKeyIfNeededOnFinalization"
41
+ --- @include "includes/removeJobsOnFail"
42
+ --- @include "includes/removeLock"
43
+
44
+ local function moveToWaitingChildren(activeKey, waitingChildrenKey, jobId,
45
+ timestamp)
46
+ local score = tonumber(timestamp)
47
+
48
+ local numRemovedElements = rcall("LREM", activeKey, -1, jobId)
49
+
50
+ if(numRemovedElements < 1) then
51
+ return -3
52
+ end
53
+
54
+ rcall("ZADD", waitingChildrenKey, score, jobId)
55
+
56
+ return 0
57
+ end
58
+
59
+ if rcall("EXISTS", jobKey) == 1 then
60
+ if rcall("ZCARD", jobUnsuccessfulKey) ~= 0 then
61
+ -- TODO: refactor this logic in an include later
62
+ local jobAttributes = rcall("HMGET", jobKey, "parent", "deid", "opts")
63
+
64
+ removeDeduplicationKeyIfNeededOnFinalization(ARGV[5], jobAttributes[2], jobId)
65
+
66
+ local failedReason = "children are failed"
67
+ rcall("ZADD", failedKey, timestamp, jobId)
68
+ rcall("HSET", jobKey, "finishedOn", timestamp)
69
+ rcall("XADD", KEYS[8], "*", "event", "failed", "jobId", jobId, "failedReason",
70
+ failedReason, "prev", "active")
71
+
72
+ local rawParentData = jobAttributes[1]
73
+ local rawOpts = jobAttributes[3]
74
+ local opts = cjson.decode(rawOpts)
75
+
76
+ moveChildFromDependenciesIfNeeded(rawParentData, jobKey, failedReason, timestamp)
77
+
78
+ removeJobsOnFail(ARGV[5], failedKey, jobId, opts, timestamp)
79
+
80
+ return 0
81
+ else
82
+ if ARGV[2] ~= "" then
83
+ if rcall("SISMEMBER", jobDependenciesKey, ARGV[2]) ~= 0 then
84
+ local errorCode = removeLock(jobKey, stalledKey, ARGV[1], jobId)
85
+ if errorCode < 0 then
86
+ return errorCode
87
+ end
88
+ return moveToWaitingChildren(activeKey, waitingChildrenKey, jobId, timestamp)
89
+ end
90
+
91
+ return 1
92
+ else
93
+ if rcall("SCARD", jobDependenciesKey) ~= 0 then
94
+ local errorCode = removeLock(jobKey, stalledKey, ARGV[1], jobId)
95
+ if errorCode < 0 then
96
+ return errorCode
97
+ end
98
+ return moveToWaitingChildren(activeKey, waitingChildrenKey, jobId, timestamp)
99
+ end
100
+
101
+ return 1
102
+ end
103
+ end
104
+ end
105
+
106
+ return -1
@@ -1,13 +1,14 @@
1
1
  --[[
2
- Remove a job from all the queues it may be in as well as all its data.
2
+ Remove a job from all the statuses it may be in as well as all its data.
3
3
  In order to be able to remove a job, it cannot be active.
4
4
 
5
5
  Input:
6
- KEYS[1] queue prefix
7
- KEYS[2] meta key
6
+ KEYS[1] jobKey
7
+ KEYS[2] repeat key
8
8
 
9
9
  ARGV[1] jobId
10
10
  ARGV[2] remove children
11
+ ARGV[3] queue prefix
11
12
 
12
13
  Events:
13
14
  'removed'
@@ -16,77 +17,28 @@
16
17
  local rcall = redis.call
17
18
 
18
19
  -- Includes
19
- --- @include "includes/destructureJobKey"
20
- --- @include "includes/getOrSetMaxEvents"
20
+ --- @include "includes/isJobSchedulerJob"
21
21
  --- @include "includes/isLocked"
22
- --- @include "includes/removeDeduplicationKey"
23
- --- @include "includes/removeJobFromAnyState"
24
- --- @include "includes/removeJobKeys"
25
- --- @include "includes/removeParentDependencyKey"
22
+ --- @include "includes/removeJobWithChildren"
26
23
 
27
- local function removeJob(prefix, jobId, parentKey, removeChildren)
28
- local jobKey = prefix .. jobId;
29
-
30
- removeParentDependencyKey(jobKey, false, parentKey, nil)
31
-
32
- if removeChildren == "1" then
33
- -- Check if this job has children
34
- -- If so, we are going to try to remove the children recursively in deep first way because
35
- -- if some job is locked we must exit with and error.
36
- -- local countProcessed = rcall("HLEN", jobKey .. ":processed")
37
- local processed = rcall("HGETALL", jobKey .. ":processed")
38
-
39
- if (#processed > 0) then
40
- for i = 1, #processed, 2 do
41
- local childJobId = getJobIdFromKey(processed[i])
42
- local childJobPrefix = getJobKeyPrefix(processed[i], childJobId)
43
- removeJob(childJobPrefix, childJobId, jobKey, removeChildren)
44
- end
45
- end
46
-
47
- local dependencies = rcall("SMEMBERS", jobKey .. ":dependencies")
48
- if (#dependencies > 0) then
49
- for i, childJobKey in ipairs(dependencies) do
50
- -- We need to get the jobId for this job.
51
- local childJobId = getJobIdFromKey(childJobKey)
52
- local childJobPrefix = getJobKeyPrefix(childJobKey, childJobId)
53
- removeJob(childJobPrefix, childJobId, jobKey, removeChildren)
54
- end
55
- end
56
-
57
- local failed = rcall("HGETALL", jobKey .. ":failed")
58
-
59
- if (#failed > 0) then
60
- for i = 1, #failed, 2 do
61
- local childJobId = getJobIdFromKey(failed[i])
62
- local childJobPrefix = getJobKeyPrefix(failed[i], childJobId)
63
- removeJob(childJobPrefix, childJobId, jobKey, removeChildren)
64
- end
65
- end
66
- end
67
-
68
- local prev = removeJobFromAnyState(prefix, jobId)
69
-
70
- removeDeduplicationKey(prefix, jobKey)
71
- if removeJobKeys(jobKey) > 0 then
72
- local maxEvents = getOrSetMaxEvents(KEYS[2])
73
- rcall("XADD", prefix .. "events", "MAXLEN", "~", maxEvents, "*", "event", "removed", "jobId", jobId, "prev",
74
- prev)
75
- end
76
- end
77
-
78
- local prefix = KEYS[1]
79
24
  local jobId = ARGV[1]
80
25
  local shouldRemoveChildren = ARGV[2]
81
- local jobKey = prefix .. jobId
26
+ local prefix = ARGV[3]
27
+ local jobKey = KEYS[1]
28
+ local repeatKey = KEYS[2]
82
29
 
83
- -- Check if the job belongs to a job scheduler and it is in delayed state.
84
- if rcall("ZSCORE", prefix .. "delayed", jobId) and rcall("HGET", jobKey, "rjk") then
85
- return -8 -- Return error code as the job is part of a job scheduler and is in delayed state.
30
+ if isJobSchedulerJob(jobId, jobKey, repeatKey) then
31
+ return -8
86
32
  end
87
33
 
88
34
  if not isLocked(prefix, jobId, shouldRemoveChildren) then
89
- removeJob(prefix, jobId, nil, shouldRemoveChildren)
35
+ local options = {
36
+ removeChildren = shouldRemoveChildren == "1",
37
+ ignoreProcessed = false,
38
+ ignoreLocked = false
39
+ }
40
+
41
+ removeJobWithChildren(prefix, jobId, nil, options)
90
42
  return 1
91
43
  end
92
44
  return 0
@@ -1,6 +1,6 @@
1
1
 
2
2
  --[[
3
- Removes a repeatable job
3
+ Removes a job scheduler and its next scheduled job.
4
4
  Input:
5
5
  KEYS[1] job schedulers key
6
6
  KEYS[2] delayed jobs key
@@ -0,0 +1,31 @@
1
+ --[[
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
+
5
+ Input:
6
+ KEYS[1] jobKey
7
+ KEYS[2] meta key
8
+
9
+ ARGV[1] prefix
10
+ ARGV[2] jobId
11
+
12
+ Events:
13
+ 'removed' for every children removed
14
+ ]]
15
+
16
+ -- Includes
17
+ --- @include "includes/removeJobWithChildren"
18
+
19
+ local prefix = ARGV[1]
20
+ local jobId = ARGV[2]
21
+
22
+ local jobKey = KEYS[1]
23
+ local metaKey = KEYS[2]
24
+
25
+ local options = {
26
+ removeChildren = "1",
27
+ ignoreProcessed = true,
28
+ ignoreLocked = true
29
+ }
30
+
31
+ removeJobChildren(prefix, jobKey, options)
@@ -19,6 +19,7 @@
19
19
  ARGV[3] pushCmd
20
20
  ARGV[4] jobId
21
21
  ARGV[5] token
22
+ ARGV[6] optional job fields to update
22
23
 
23
24
  Events:
24
25
  'waiting'
@@ -36,9 +37,10 @@ local rcall = redis.call
36
37
  --- @include "includes/addJobWithPriority"
37
38
  --- @include "includes/getOrSetMaxEvents"
38
39
  --- @include "includes/getTargetQueueList"
40
+ --- @include "includes/isQueuePausedOrMaxed"
39
41
  --- @include "includes/promoteDelayedJobs"
40
42
  --- @include "includes/removeLock"
41
- --- @include "includes/isQueuePausedOrMaxed"
43
+ --- @include "includes/updateJobFields"
42
44
 
43
45
  local target, isPausedOrMaxed = getTargetQueueList(KEYS[5], KEYS[1], KEYS[2], KEYS[3])
44
46
  local markerKey = KEYS[10]
@@ -47,16 +49,20 @@ local markerKey = KEYS[10]
47
49
  -- test example: when there are delayed jobs between retries
48
50
  promoteDelayedJobs(KEYS[7], markerKey, target, KEYS[8], KEYS[6], ARGV[1], ARGV[2], KEYS[9], isPausedOrMaxed)
49
51
 
50
- if rcall("EXISTS", KEYS[4]) == 1 then
51
- local errorCode = removeLock(KEYS[4], KEYS[11], ARGV[5], ARGV[4])
52
+ local jobKey = KEYS[4]
53
+
54
+ if rcall("EXISTS", jobKey) == 1 then
55
+ local errorCode = removeLock(jobKey, KEYS[11], ARGV[5], ARGV[4])
52
56
  if errorCode < 0 then
53
57
  return errorCode
54
58
  end
55
59
 
60
+ updateJobFields(jobKey, ARGV[6])
61
+
56
62
  local numRemovedElements = rcall("LREM", KEYS[1], -1, ARGV[4])
57
63
  if (numRemovedElements < 1) then return -3 end
58
64
 
59
- local priority = tonumber(rcall("HGET", KEYS[4], "priority")) or 0
65
+ local priority = tonumber(rcall("HGET", jobKey, "priority")) or 0
60
66
 
61
67
  --need to re-evaluate after removing job from active
62
68
  isPausedOrMaxed = isQueuePausedOrMaxed(KEYS[5], KEYS[1])
@@ -68,7 +74,7 @@ if rcall("EXISTS", KEYS[4]) == 1 then
68
74
  addJobWithPriority(markerKey, KEYS[8], priority, ARGV[4], KEYS[9], isPausedOrMaxed)
69
75
  end
70
76
 
71
- rcall("HINCRBY", KEYS[4], "atm", 1)
77
+ rcall("HINCRBY", jobKey, "atm", 1)
72
78
 
73
79
  local maxEvents = getOrSetMaxEvents(KEYS[5])
74
80
 
@@ -0,0 +1,90 @@
1
+ --[[
2
+ Updates a job scheduler and adds next delayed job
3
+
4
+ Input:
5
+ KEYS[1] 'repeat' key
6
+ KEYS[2] 'delayed'
7
+ KEYS[3] 'wait' key
8
+ KEYS[4] 'paused' key
9
+ KEYS[5] 'meta'
10
+ KEYS[6] 'prioritized' key
11
+ KEYS[7] 'marker',
12
+ KEYS[8] 'id'
13
+ KEYS[9] events stream key
14
+ KEYS[10] 'pc' priority counter
15
+ KEYS[11] producer key
16
+ KEYS[12] 'active' key
17
+
18
+ ARGV[1] next milliseconds
19
+ ARGV[2] jobs scheduler id
20
+ ARGV[3] Json stringified delayed data
21
+ ARGV[4] msgpacked delayed opts
22
+ ARGV[5] timestamp
23
+ ARGV[6] prefix key
24
+ ARGV[7] producer id
25
+
26
+ Output:
27
+ next delayed job id - OK
28
+ ]]
29
+ local rcall = redis.call
30
+ local repeatKey = KEYS[1]
31
+ local delayedKey = KEYS[2]
32
+ local waitKey = KEYS[3]
33
+ local pausedKey = KEYS[4]
34
+ local metaKey = KEYS[5]
35
+ local prioritizedKey = KEYS[6]
36
+ local nextMillis = ARGV[1]
37
+ local jobSchedulerId = ARGV[2]
38
+ local timestamp = ARGV[5]
39
+ local prefixKey = ARGV[6]
40
+ local producerId = ARGV[7]
41
+
42
+ -- Includes
43
+ --- @include "includes/addJobFromScheduler"
44
+ --- @include "includes/getOrSetMaxEvents"
45
+
46
+ local schedulerKey = repeatKey .. ":" .. jobSchedulerId
47
+ local nextDelayedJobId = "repeat:" .. jobSchedulerId .. ":" .. nextMillis
48
+ local nextDelayedJobKey = schedulerKey .. ":" .. nextMillis
49
+
50
+ -- Validate that scheduler exists.
51
+ local prevMillis = rcall("ZSCORE", repeatKey, jobSchedulerId)
52
+ if prevMillis then
53
+ local currentDelayedJobId = "repeat:" .. jobSchedulerId .. ":" .. prevMillis
54
+
55
+ if producerId == currentDelayedJobId then
56
+ local eventsKey = KEYS[9]
57
+ local maxEvents = getOrSetMaxEvents(metaKey)
58
+
59
+ if rcall("EXISTS", nextDelayedJobKey) ~= 1 then
60
+ local schedulerAttributes = rcall("HMGET", schedulerKey, "name", "data")
61
+
62
+ rcall("ZADD", repeatKey, nextMillis, jobSchedulerId)
63
+ rcall("HINCRBY", schedulerKey, "ic", 1)
64
+
65
+ rcall("INCR", KEYS[8])
66
+
67
+ -- TODO: remove this workaround in next breaking change,
68
+ -- all job-schedulers must save job data
69
+ local templateData = schedulerAttributes[2] or ARGV[3]
70
+
71
+ if templateData and templateData ~= '{}' then
72
+ rcall("HSET", schedulerKey, "data", templateData)
73
+ end
74
+
75
+ addJobFromScheduler(nextDelayedJobKey, nextDelayedJobId, ARGV[4], waitKey, pausedKey,
76
+ KEYS[12], metaKey, prioritizedKey, KEYS[10], delayedKey, KEYS[7], eventsKey,
77
+ schedulerAttributes[1], maxEvents, ARGV[5], templateData or '{}', jobSchedulerId)
78
+
79
+ -- TODO: remove this workaround in next breaking change
80
+ if KEYS[11] ~= "" then
81
+ rcall("HSET", KEYS[11], "nrjid", nextDelayedJobId)
82
+ end
83
+
84
+ return nextDelayedJobId .. "" -- convert to string
85
+ else
86
+ rcall("XADD", eventsKey, "MAXLEN", "~", maxEvents, "*", "event",
87
+ "duplicated", "jobId", nextDelayedJobId)
88
+ end
89
+ end
90
+ end
@@ -17,7 +17,7 @@ local nextMillis = ARGV[1]
17
17
  local customKey = ARGV[2]
18
18
  local legacyCustomKey = ARGV[3]
19
19
 
20
- if rcall("ZSCORE", repeatKey, customKey) ~= false then
20
+ if rcall("ZSCORE", repeatKey, customKey) then
21
21
  rcall("ZADD", repeatKey, nextMillis, customKey)
22
22
  return customKey
23
23
  elseif rcall("ZSCORE", repeatKey, legacyCustomKey) ~= false then
@@ -6,5 +6,7 @@ var ChildCommand;
6
6
  ChildCommand[ChildCommand["Init"] = 0] = "Init";
7
7
  ChildCommand[ChildCommand["Start"] = 1] = "Start";
8
8
  ChildCommand[ChildCommand["Stop"] = 2] = "Stop";
9
+ ChildCommand[ChildCommand["GetChildrenValuesResponse"] = 3] = "GetChildrenValuesResponse";
10
+ ChildCommand[ChildCommand["GetIgnoredChildrenFailuresResponse"] = 4] = "GetIgnoredChildrenFailuresResponse";
9
11
  })(ChildCommand = exports.ChildCommand || (exports.ChildCommand = {}));
10
12
  //# sourceMappingURL=child-command.js.map
@@ -6,10 +6,11 @@ var ErrorCode;
6
6
  ErrorCode[ErrorCode["JobNotExist"] = -1] = "JobNotExist";
7
7
  ErrorCode[ErrorCode["JobLockNotExist"] = -2] = "JobLockNotExist";
8
8
  ErrorCode[ErrorCode["JobNotInState"] = -3] = "JobNotInState";
9
- ErrorCode[ErrorCode["JobPendingDependencies"] = -4] = "JobPendingDependencies";
9
+ ErrorCode[ErrorCode["JobPendingChildren"] = -4] = "JobPendingChildren";
10
10
  ErrorCode[ErrorCode["ParentJobNotExist"] = -5] = "ParentJobNotExist";
11
11
  ErrorCode[ErrorCode["JobLockMismatch"] = -6] = "JobLockMismatch";
12
12
  ErrorCode[ErrorCode["ParentJobCannotBeReplaced"] = -7] = "ParentJobCannotBeReplaced";
13
13
  ErrorCode[ErrorCode["JobBelongsToJobScheduler"] = -8] = "JobBelongsToJobScheduler";
14
+ ErrorCode[ErrorCode["JobFailedChildren"] = -9] = "JobFailedChildren";
14
15
  })(ErrorCode = exports.ErrorCode || (exports.ErrorCode = {}));
15
16
  //# sourceMappingURL=error-code.js.map
@@ -10,7 +10,10 @@ var ParentCommand;
10
10
  ParentCommand[ParentCommand["InitCompleted"] = 4] = "InitCompleted";
11
11
  ParentCommand[ParentCommand["Log"] = 5] = "Log";
12
12
  ParentCommand[ParentCommand["MoveToDelayed"] = 6] = "MoveToDelayed";
13
- ParentCommand[ParentCommand["Progress"] = 7] = "Progress";
14
- ParentCommand[ParentCommand["Update"] = 8] = "Update";
13
+ ParentCommand[ParentCommand["MoveToWait"] = 7] = "MoveToWait";
14
+ ParentCommand[ParentCommand["Progress"] = 8] = "Progress";
15
+ ParentCommand[ParentCommand["Update"] = 9] = "Update";
16
+ ParentCommand[ParentCommand["GetChildrenValues"] = 10] = "GetChildrenValues";
17
+ ParentCommand[ParentCommand["GetIgnoredChildrenFailures"] = 11] = "GetIgnoredChildrenFailures";
15
18
  })(ParentCommand = exports.ParentCommand || (exports.ParentCommand = {}));
16
19
  //# sourceMappingURL=parent-command.js.map