bullmq 5.59.0 → 5.61.0

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 (91) hide show
  1. package/dist/cjs/classes/queue.js +16 -0
  2. package/dist/cjs/classes/queue.js.map +1 -1
  3. package/dist/cjs/classes/scripts.js +4 -1
  4. package/dist/cjs/classes/scripts.js.map +1 -1
  5. package/dist/cjs/classes/worker.js +5 -8
  6. package/dist/cjs/classes/worker.js.map +1 -1
  7. package/dist/cjs/commands/changePriority-7.lua +1 -1
  8. package/dist/cjs/commands/{getRateLimitTtl-1.lua → getRateLimitTtl-2.lua} +6 -0
  9. package/dist/cjs/commands/includes/getTargetQueueList.lua +5 -5
  10. package/dist/cjs/commands/includes/prepareJobForProcessing.lua +2 -4
  11. package/dist/cjs/commands/moveStalledJobsToWait-8.lua +0 -1
  12. package/dist/cjs/commands/moveToActive-11.lua +7 -4
  13. package/dist/cjs/commands/moveToFinished-14.lua +10 -7
  14. package/dist/cjs/scripts/addDelayedJob-6.js +5 -5
  15. package/dist/cjs/scripts/addJobScheduler-11.js +5 -5
  16. package/dist/cjs/scripts/addParentJob-5.js +5 -5
  17. package/dist/cjs/scripts/addPrioritizedJob-9.js +5 -5
  18. package/dist/cjs/scripts/addRepeatableJob-2.js +5 -5
  19. package/dist/cjs/scripts/addStandardJob-9.js +5 -5
  20. package/dist/cjs/scripts/changePriority-7.js +5 -5
  21. package/dist/cjs/scripts/cleanJobsInSet-3.js +5 -5
  22. package/dist/cjs/scripts/drain-5.js +5 -5
  23. package/dist/cjs/scripts/{getRateLimitTtl-1.js → getRateLimitTtl-2.js} +7 -2
  24. package/dist/cjs/scripts/getRateLimitTtl-2.js.map +1 -0
  25. package/dist/cjs/scripts/index.js +1 -1
  26. package/dist/cjs/scripts/moveJobFromActiveToWait-9.js +5 -5
  27. package/dist/cjs/scripts/moveJobsToWait-8.js +5 -5
  28. package/dist/cjs/scripts/moveStalledJobsToWait-8.js +9 -9
  29. package/dist/cjs/scripts/moveToActive-11.js +13 -12
  30. package/dist/cjs/scripts/moveToActive-11.js.map +1 -1
  31. package/dist/cjs/scripts/moveToFinished-14.js +16 -15
  32. package/dist/cjs/scripts/moveToFinished-14.js.map +1 -1
  33. package/dist/cjs/scripts/obliterate-2.js +5 -5
  34. package/dist/cjs/scripts/promote-9.js +5 -5
  35. package/dist/cjs/scripts/removeChildDependency-1.js +5 -5
  36. package/dist/cjs/scripts/removeJob-2.js +5 -5
  37. package/dist/cjs/scripts/removeUnprocessedChildren-2.js +5 -5
  38. package/dist/cjs/scripts/reprocessJob-8.js +5 -5
  39. package/dist/cjs/scripts/retryJob-11.js +5 -5
  40. package/dist/cjs/scripts/updateJobScheduler-12.js +5 -5
  41. package/dist/cjs/tsconfig-cjs.tsbuildinfo +1 -1
  42. package/dist/cjs/version.js +1 -1
  43. package/dist/esm/classes/queue.d.ts +10 -0
  44. package/dist/esm/classes/queue.js +16 -0
  45. package/dist/esm/classes/queue.js.map +1 -1
  46. package/dist/esm/classes/scripts.js +4 -1
  47. package/dist/esm/classes/scripts.js.map +1 -1
  48. package/dist/esm/classes/worker.js +5 -8
  49. package/dist/esm/classes/worker.js.map +1 -1
  50. package/dist/esm/commands/changePriority-7.lua +1 -1
  51. package/dist/esm/commands/{getRateLimitTtl-1.lua → getRateLimitTtl-2.lua} +6 -0
  52. package/dist/esm/commands/includes/getTargetQueueList.lua +5 -5
  53. package/dist/esm/commands/includes/prepareJobForProcessing.lua +2 -4
  54. package/dist/esm/commands/moveStalledJobsToWait-8.lua +0 -1
  55. package/dist/esm/commands/moveToActive-11.lua +7 -4
  56. package/dist/esm/commands/moveToFinished-14.lua +10 -7
  57. package/dist/esm/scripts/addDelayedJob-6.js +5 -5
  58. package/dist/esm/scripts/addJobScheduler-11.js +5 -5
  59. package/dist/esm/scripts/addParentJob-5.js +5 -5
  60. package/dist/esm/scripts/addPrioritizedJob-9.js +5 -5
  61. package/dist/esm/scripts/addRepeatableJob-2.js +5 -5
  62. package/dist/esm/scripts/addStandardJob-9.js +5 -5
  63. package/dist/esm/scripts/changePriority-7.js +5 -5
  64. package/dist/esm/scripts/cleanJobsInSet-3.js +5 -5
  65. package/dist/esm/scripts/drain-5.js +5 -5
  66. package/dist/esm/scripts/{getRateLimitTtl-1.js → getRateLimitTtl-2.js} +7 -2
  67. package/dist/esm/scripts/getRateLimitTtl-2.js.map +1 -0
  68. package/dist/esm/scripts/index.d.ts +1 -1
  69. package/dist/esm/scripts/index.js +1 -1
  70. package/dist/esm/scripts/moveJobFromActiveToWait-9.js +5 -5
  71. package/dist/esm/scripts/moveJobsToWait-8.js +5 -5
  72. package/dist/esm/scripts/moveStalledJobsToWait-8.js +9 -9
  73. package/dist/esm/scripts/moveToActive-11.js +13 -12
  74. package/dist/esm/scripts/moveToActive-11.js.map +1 -1
  75. package/dist/esm/scripts/moveToFinished-14.js +16 -15
  76. package/dist/esm/scripts/moveToFinished-14.js.map +1 -1
  77. package/dist/esm/scripts/obliterate-2.js +5 -5
  78. package/dist/esm/scripts/promote-9.js +5 -5
  79. package/dist/esm/scripts/removeChildDependency-1.js +5 -5
  80. package/dist/esm/scripts/removeJob-2.js +5 -5
  81. package/dist/esm/scripts/removeUnprocessedChildren-2.js +5 -5
  82. package/dist/esm/scripts/reprocessJob-8.js +5 -5
  83. package/dist/esm/scripts/retryJob-11.js +5 -5
  84. package/dist/esm/scripts/updateJobScheduler-12.js +5 -5
  85. package/dist/esm/tsconfig.tsbuildinfo +1 -1
  86. package/dist/esm/version.d.ts +1 -1
  87. package/dist/esm/version.js +1 -1
  88. package/package.json +1 -1
  89. package/dist/cjs/scripts/getRateLimitTtl-1.js.map +0 -1
  90. package/dist/esm/scripts/getRateLimitTtl-1.js.map +0 -1
  91. /package/dist/esm/scripts/{getRateLimitTtl-1.d.ts → getRateLimitTtl-2.d.ts} +0 -0
@@ -83,20 +83,20 @@ end
83
83
  (since an empty list and !EXISTS are not really the same).
84
84
  ]]
85
85
  local function getTargetQueueList(queueMetaKey, activeKey, waitKey, pausedKey)
86
- local queueAttributes = rcall("HMGET", queueMetaKey, "paused", "concurrency")
86
+ local queueAttributes = rcall("HMGET", queueMetaKey, "paused", "concurrency", "max", "duration")
87
87
  if queueAttributes[1] then
88
- return pausedKey, true
88
+ return pausedKey, true, queueAttributes[3], queueAttributes[4]
89
89
  else
90
90
  if queueAttributes[2] then
91
91
  local activeCount = rcall("LLEN", activeKey)
92
92
  if activeCount >= tonumber(queueAttributes[2]) then
93
- return waitKey, true
93
+ return waitKey, true, queueAttributes[3], queueAttributes[4]
94
94
  else
95
- return waitKey, false
95
+ return waitKey, false, queueAttributes[3], queueAttributes[4]
96
96
  end
97
97
  end
98
98
  end
99
- return waitKey, false
99
+ return waitKey, false, queueAttributes[3], queueAttributes[4]
100
100
  end
101
101
  local function _moveParentToWait(parentPrefix, parentId, emitEvent)
102
102
  local parentTarget, isPausedOrMaxed = getTargetQueueList(parentPrefix .. "meta", parentPrefix .. "active",
@@ -59,20 +59,20 @@ end
59
59
  (since an empty list and !EXISTS are not really the same).
60
60
  ]]
61
61
  local function getTargetQueueList(queueMetaKey, activeKey, waitKey, pausedKey)
62
- local queueAttributes = rcall("HMGET", queueMetaKey, "paused", "concurrency")
62
+ local queueAttributes = rcall("HMGET", queueMetaKey, "paused", "concurrency", "max", "duration")
63
63
  if queueAttributes[1] then
64
- return pausedKey, true
64
+ return pausedKey, true, queueAttributes[3], queueAttributes[4]
65
65
  else
66
66
  if queueAttributes[2] then
67
67
  local activeCount = rcall("LLEN", activeKey)
68
68
  if activeCount >= tonumber(queueAttributes[2]) then
69
- return waitKey, true
69
+ return waitKey, true, queueAttributes[3], queueAttributes[4]
70
70
  else
71
- return waitKey, false
71
+ return waitKey, false, queueAttributes[3], queueAttributes[4]
72
72
  end
73
73
  end
74
74
  end
75
- return waitKey, false
75
+ return waitKey, false, queueAttributes[3], queueAttributes[4]
76
76
  end
77
77
  if rcall("ZREM", KEYS[1], jobId) == 1 then
78
78
  local jobKey = ARGV[1] .. jobId
@@ -52,20 +52,20 @@ end
52
52
  (since an empty list and !EXISTS are not really the same).
53
53
  ]]
54
54
  local function getTargetQueueList(queueMetaKey, activeKey, waitKey, pausedKey)
55
- local queueAttributes = rcall("HMGET", queueMetaKey, "paused", "concurrency")
55
+ local queueAttributes = rcall("HMGET", queueMetaKey, "paused", "concurrency", "max", "duration")
56
56
  if queueAttributes[1] then
57
- return pausedKey, true
57
+ return pausedKey, true, queueAttributes[3], queueAttributes[4]
58
58
  else
59
59
  if queueAttributes[2] then
60
60
  local activeCount = rcall("LLEN", activeKey)
61
61
  if activeCount >= tonumber(queueAttributes[2]) then
62
- return waitKey, true
62
+ return waitKey, true, queueAttributes[3], queueAttributes[4]
63
63
  else
64
- return waitKey, false
64
+ return waitKey, false, queueAttributes[3], queueAttributes[4]
65
65
  end
66
66
  end
67
67
  end
68
- return waitKey, false
68
+ return waitKey, false, queueAttributes[3], queueAttributes[4]
69
69
  end
70
70
  --[[
71
71
  Function to remove job keys.
@@ -167,20 +167,20 @@ end
167
167
  (since an empty list and !EXISTS are not really the same).
168
168
  ]]
169
169
  local function getTargetQueueList(queueMetaKey, activeKey, waitKey, pausedKey)
170
- local queueAttributes = rcall("HMGET", queueMetaKey, "paused", "concurrency")
170
+ local queueAttributes = rcall("HMGET", queueMetaKey, "paused", "concurrency", "max", "duration")
171
171
  if queueAttributes[1] then
172
- return pausedKey, true
172
+ return pausedKey, true, queueAttributes[3], queueAttributes[4]
173
173
  else
174
174
  if queueAttributes[2] then
175
175
  local activeCount = rcall("LLEN", activeKey)
176
176
  if activeCount >= tonumber(queueAttributes[2]) then
177
- return waitKey, true
177
+ return waitKey, true, queueAttributes[3], queueAttributes[4]
178
178
  else
179
- return waitKey, false
179
+ return waitKey, false, queueAttributes[3], queueAttributes[4]
180
180
  end
181
181
  end
182
182
  end
183
- return waitKey, false
183
+ return waitKey, false, queueAttributes[3], queueAttributes[4]
184
184
  end
185
185
  local function _moveParentToWait(parentPrefix, parentId, emitEvent)
186
186
  local parentTarget, isPausedOrMaxed = getTargetQueueList(parentPrefix .. "meta", parentPrefix .. "active",
@@ -135,20 +135,20 @@ end
135
135
  (since an empty list and !EXISTS are not really the same).
136
136
  ]]
137
137
  local function getTargetQueueList(queueMetaKey, activeKey, waitKey, pausedKey)
138
- local queueAttributes = rcall("HMGET", queueMetaKey, "paused", "concurrency")
138
+ local queueAttributes = rcall("HMGET", queueMetaKey, "paused", "concurrency", "max", "duration")
139
139
  if queueAttributes[1] then
140
- return pausedKey, true
140
+ return pausedKey, true, queueAttributes[3], queueAttributes[4]
141
141
  else
142
142
  if queueAttributes[2] then
143
143
  local activeCount = rcall("LLEN", activeKey)
144
144
  if activeCount >= tonumber(queueAttributes[2]) then
145
- return waitKey, true
145
+ return waitKey, true, queueAttributes[3], queueAttributes[4]
146
146
  else
147
- return waitKey, false
147
+ return waitKey, false, queueAttributes[3], queueAttributes[4]
148
148
  end
149
149
  end
150
150
  end
151
- return waitKey, false
151
+ return waitKey, false, queueAttributes[3], queueAttributes[4]
152
152
  end
153
153
  local function _moveParentToWait(parentPrefix, parentId, emitEvent)
154
154
  local parentTarget, isPausedOrMaxed = getTargetQueueList(parentPrefix .. "meta", parentPrefix .. "active",
@@ -52,20 +52,20 @@ end
52
52
  (since an empty list and !EXISTS are not really the same).
53
53
  ]]
54
54
  local function getTargetQueueList(queueMetaKey, activeKey, waitKey, pausedKey)
55
- local queueAttributes = rcall("HMGET", queueMetaKey, "paused", "concurrency")
55
+ local queueAttributes = rcall("HMGET", queueMetaKey, "paused", "concurrency", "max", "duration")
56
56
  if queueAttributes[1] then
57
- return pausedKey, true
57
+ return pausedKey, true, queueAttributes[3], queueAttributes[4]
58
58
  else
59
59
  if queueAttributes[2] then
60
60
  local activeCount = rcall("LLEN", activeKey)
61
61
  if activeCount >= tonumber(queueAttributes[2]) then
62
- return waitKey, true
62
+ return waitKey, true, queueAttributes[3], queueAttributes[4]
63
63
  else
64
- return waitKey, false
64
+ return waitKey, false, queueAttributes[3], queueAttributes[4]
65
65
  end
66
66
  end
67
67
  end
68
- return waitKey, false
68
+ return waitKey, false, queueAttributes[3], queueAttributes[4]
69
69
  end
70
70
  local jobKey = KEYS[1]
71
71
  if rcall("EXISTS", jobKey) == 1 then
@@ -77,20 +77,20 @@ end
77
77
  (since an empty list and !EXISTS are not really the same).
78
78
  ]]
79
79
  local function getTargetQueueList(queueMetaKey, activeKey, waitKey, pausedKey)
80
- local queueAttributes = rcall("HMGET", queueMetaKey, "paused", "concurrency")
80
+ local queueAttributes = rcall("HMGET", queueMetaKey, "paused", "concurrency", "max", "duration")
81
81
  if queueAttributes[1] then
82
- return pausedKey, true
82
+ return pausedKey, true, queueAttributes[3], queueAttributes[4]
83
83
  else
84
84
  if queueAttributes[2] then
85
85
  local activeCount = rcall("LLEN", activeKey)
86
86
  if activeCount >= tonumber(queueAttributes[2]) then
87
- return waitKey, true
87
+ return waitKey, true, queueAttributes[3], queueAttributes[4]
88
88
  else
89
- return waitKey, false
89
+ return waitKey, false, queueAttributes[3], queueAttributes[4]
90
90
  end
91
91
  end
92
92
  end
93
- return waitKey, false
93
+ return waitKey, false, queueAttributes[3], queueAttributes[4]
94
94
  end
95
95
  --[[
96
96
  Function to check if queue is paused or maxed
@@ -171,20 +171,20 @@ end
171
171
  (since an empty list and !EXISTS are not really the same).
172
172
  ]]
173
173
  local function getTargetQueueList(queueMetaKey, activeKey, waitKey, pausedKey)
174
- local queueAttributes = rcall("HMGET", queueMetaKey, "paused", "concurrency")
174
+ local queueAttributes = rcall("HMGET", queueMetaKey, "paused", "concurrency", "max", "duration")
175
175
  if queueAttributes[1] then
176
- return pausedKey, true
176
+ return pausedKey, true, queueAttributes[3], queueAttributes[4]
177
177
  else
178
178
  if queueAttributes[2] then
179
179
  local activeCount = rcall("LLEN", activeKey)
180
180
  if activeCount >= tonumber(queueAttributes[2]) then
181
- return waitKey, true
181
+ return waitKey, true, queueAttributes[3], queueAttributes[4]
182
182
  else
183
- return waitKey, false
183
+ return waitKey, false, queueAttributes[3], queueAttributes[4]
184
184
  end
185
185
  end
186
186
  end
187
- return waitKey, false
187
+ return waitKey, false, queueAttributes[3], queueAttributes[4]
188
188
  end
189
189
  --[[
190
190
  Function to add job in target list and add marker if needed.