bullmq 5.1.0 → 5.1.1

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 (92) hide show
  1. package/dist/cjs/classes/redis-connection.js +11 -3
  2. package/dist/cjs/classes/redis-connection.js.map +1 -1
  3. package/dist/cjs/classes/worker.js +4 -2
  4. package/dist/cjs/classes/worker.js.map +1 -1
  5. package/dist/cjs/commands/addDelayedJob-6.lua +2 -3
  6. package/dist/cjs/commands/addStandardJob-7.lua +1 -1
  7. package/dist/cjs/commands/includes/getJobsInZset.lua +6 -4
  8. package/dist/cjs/commands/includes/getNextDelayedTimestamp.lua +1 -1
  9. package/dist/cjs/commands/includes/getOrSetMaxEvents.lua +3 -1
  10. package/dist/cjs/commands/includes/getRateLimitTTL.lua +3 -0
  11. package/dist/cjs/commands/includes/trimEvents.lua +4 -1
  12. package/dist/cjs/commands/includes/updateExistingJobsParent.lua +4 -2
  13. package/dist/cjs/commands/moveJobsToWait-6.lua +2 -1
  14. package/dist/cjs/commands/moveToDelayed-7.lua +2 -1
  15. package/dist/cjs/commands/removeJob-1.lua +2 -1
  16. package/dist/cjs/commands/retryJob-10.lua +2 -1
  17. package/dist/cjs/commands/updateProgress-3.lua +4 -1
  18. package/dist/cjs/scripts/addDelayedJob-6.js +44 -40
  19. package/dist/cjs/scripts/addDelayedJob-6.js.map +1 -1
  20. package/dist/cjs/scripts/addParentJob-4.js +11 -7
  21. package/dist/cjs/scripts/addParentJob-4.js.map +1 -1
  22. package/dist/cjs/scripts/addPrioritizedJob-7.js +11 -7
  23. package/dist/cjs/scripts/addPrioritizedJob-7.js.map +1 -1
  24. package/dist/cjs/scripts/addStandardJob-7.js +11 -7
  25. package/dist/cjs/scripts/addStandardJob-7.js.map +1 -1
  26. package/dist/cjs/scripts/cleanJobsInSet-2.js +6 -4
  27. package/dist/cjs/scripts/cleanJobsInSet-2.js.map +1 -1
  28. package/dist/cjs/scripts/moveJobsToWait-6.js +12 -1
  29. package/dist/cjs/scripts/moveJobsToWait-6.js.map +1 -1
  30. package/dist/cjs/scripts/moveStalledJobsToWait-8.js +13 -1
  31. package/dist/cjs/scripts/moveStalledJobsToWait-8.js.map +1 -1
  32. package/dist/cjs/scripts/moveToActive-11.js +4 -1
  33. package/dist/cjs/scripts/moveToActive-11.js.map +1 -1
  34. package/dist/cjs/scripts/moveToDelayed-7.js +13 -2
  35. package/dist/cjs/scripts/moveToDelayed-7.js.map +1 -1
  36. package/dist/cjs/scripts/moveToFinished-14.js +17 -2
  37. package/dist/cjs/scripts/moveToFinished-14.js.map +1 -1
  38. package/dist/cjs/scripts/pause-7.js +1 -1
  39. package/dist/cjs/scripts/removeJob-1.js +12 -1
  40. package/dist/cjs/scripts/removeJob-1.js.map +1 -1
  41. package/dist/cjs/scripts/retryJob-10.js +12 -1
  42. package/dist/cjs/scripts/retryJob-10.js.map +1 -1
  43. package/dist/cjs/scripts/updateProgress-3.js +13 -1
  44. package/dist/cjs/scripts/updateProgress-3.js.map +1 -1
  45. package/dist/cjs/tsconfig-cjs.tsbuildinfo +1 -1
  46. package/dist/esm/classes/redis-connection.d.ts +1 -0
  47. package/dist/esm/classes/redis-connection.js +11 -3
  48. package/dist/esm/classes/redis-connection.js.map +1 -1
  49. package/dist/esm/classes/worker.js +4 -2
  50. package/dist/esm/classes/worker.js.map +1 -1
  51. package/dist/esm/commands/addDelayedJob-6.lua +2 -3
  52. package/dist/esm/commands/addStandardJob-7.lua +1 -1
  53. package/dist/esm/commands/includes/getJobsInZset.lua +6 -4
  54. package/dist/esm/commands/includes/getNextDelayedTimestamp.lua +1 -1
  55. package/dist/esm/commands/includes/getOrSetMaxEvents.lua +3 -1
  56. package/dist/esm/commands/includes/getRateLimitTTL.lua +3 -0
  57. package/dist/esm/commands/includes/trimEvents.lua +4 -1
  58. package/dist/esm/commands/includes/updateExistingJobsParent.lua +4 -2
  59. package/dist/esm/commands/moveJobsToWait-6.lua +2 -1
  60. package/dist/esm/commands/moveToDelayed-7.lua +2 -1
  61. package/dist/esm/commands/removeJob-1.lua +2 -1
  62. package/dist/esm/commands/retryJob-10.lua +2 -1
  63. package/dist/esm/commands/updateProgress-3.lua +4 -1
  64. package/dist/esm/scripts/addDelayedJob-6.js +44 -40
  65. package/dist/esm/scripts/addDelayedJob-6.js.map +1 -1
  66. package/dist/esm/scripts/addParentJob-4.js +11 -7
  67. package/dist/esm/scripts/addParentJob-4.js.map +1 -1
  68. package/dist/esm/scripts/addPrioritizedJob-7.js +11 -7
  69. package/dist/esm/scripts/addPrioritizedJob-7.js.map +1 -1
  70. package/dist/esm/scripts/addStandardJob-7.js +11 -7
  71. package/dist/esm/scripts/addStandardJob-7.js.map +1 -1
  72. package/dist/esm/scripts/cleanJobsInSet-2.js +6 -4
  73. package/dist/esm/scripts/cleanJobsInSet-2.js.map +1 -1
  74. package/dist/esm/scripts/moveJobsToWait-6.js +12 -1
  75. package/dist/esm/scripts/moveJobsToWait-6.js.map +1 -1
  76. package/dist/esm/scripts/moveStalledJobsToWait-8.js +13 -1
  77. package/dist/esm/scripts/moveStalledJobsToWait-8.js.map +1 -1
  78. package/dist/esm/scripts/moveToActive-11.js +4 -1
  79. package/dist/esm/scripts/moveToActive-11.js.map +1 -1
  80. package/dist/esm/scripts/moveToDelayed-7.js +13 -2
  81. package/dist/esm/scripts/moveToDelayed-7.js.map +1 -1
  82. package/dist/esm/scripts/moveToFinished-14.js +17 -2
  83. package/dist/esm/scripts/moveToFinished-14.js.map +1 -1
  84. package/dist/esm/scripts/pause-7.js +1 -1
  85. package/dist/esm/scripts/removeJob-1.js +12 -1
  86. package/dist/esm/scripts/removeJob-1.js.map +1 -1
  87. package/dist/esm/scripts/retryJob-10.js +12 -1
  88. package/dist/esm/scripts/retryJob-10.js.map +1 -1
  89. package/dist/esm/scripts/updateProgress-3.js +13 -1
  90. package/dist/esm/scripts/updateProgress-3.js.map +1 -1
  91. package/dist/esm/tsconfig.tsbuildinfo +1 -1
  92. package/package.json +1 -1
@@ -2,8 +2,11 @@
2
2
  Function to trim events, default 10000.
3
3
  ]]
4
4
 
5
+ -- Includes
6
+ --- @include "getOrSetMaxEvents"
7
+
5
8
  local function trimEvents(metaKey, eventStreamKey)
6
- local maxEvents = rcall("HGET", metaKey, "opts.maxLenEvents")
9
+ local maxEvents = getOrSetMaxEvents(metaKey)
7
10
  if maxEvents ~= false then
8
11
  rcall("XTRIM", eventStreamKey, "MAXLEN", "~", maxEvents)
9
12
  else
@@ -1,11 +1,13 @@
1
- --- @include "updateParentDepsIfNeeded"
2
-
3
1
  --[[
4
2
  This function is used to update the parent's dependencies if the job
5
3
  is already completed and about to be ignored. The parent must get its
6
4
  dependencies updated to avoid the parent job being stuck forever in
7
5
  the waiting-children state.
8
6
  ]]
7
+
8
+ -- Includes
9
+ --- @include "updateParentDepsIfNeeded"
10
+
9
11
  local function updateExistingJobsParent(parentKey, parent, parentData,
10
12
  parentDependenciesKey, completedKey,
11
13
  jobIdKey, jobId, timestamp)
@@ -26,6 +26,7 @@ local rcall = redis.call;
26
26
 
27
27
  -- Includes
28
28
  --- @include "includes/batches"
29
+ --- @include "includes/getOrSetMaxEvents"
29
30
  --- @include "includes/getTargetQueueList"
30
31
 
31
32
  local metaKey = KEYS[6]
@@ -46,7 +47,7 @@ if (#jobs > 0) then
46
47
  end
47
48
  end
48
49
 
49
- local maxEvents = rcall("HGET", metaKey, "opts.maxLenEvents") or 10000
50
+ local maxEvents = getOrSetMaxEvents(metaKey)
50
51
 
51
52
  for i, key in ipairs(jobs) do
52
53
  -- Emit waiting event
@@ -30,6 +30,7 @@ local rcall = redis.call
30
30
 
31
31
  -- Includes
32
32
  --- @include "includes/addDelayMarkerIfNeeded"
33
+ --- @include "includes/getOrSetMaxEvents"
33
34
  --- @include "includes/isQueuePaused"
34
35
 
35
36
  local jobKey = KEYS[5]
@@ -58,7 +59,7 @@ if rcall("EXISTS", jobKey) == 1 then
58
59
 
59
60
  rcall("HSET", jobKey, "delay", ARGV[6])
60
61
 
61
- local maxEvents = rcall("HGET", metaKey, "opts.maxLenEvents") or 10000
62
+ local maxEvents = getOrSetMaxEvents(metaKey)
62
63
 
63
64
  rcall("ZADD", delayedKey, score, jobId)
64
65
  rcall("XADD", KEYS[6], "MAXLEN", "~", maxEvents, "*", "event", "delayed",
@@ -16,6 +16,7 @@ local rcall = redis.call
16
16
 
17
17
  -- Includes
18
18
  --- @include "includes/destructureJobKey"
19
+ --- @include "includes/getOrSetMaxEvents"
19
20
  --- @include "includes/isLocked"
20
21
  --- @include "includes/removeJobFromAnyState"
21
22
  --- @include "includes/removeParentDependencyKey"
@@ -54,7 +55,7 @@ local function removeJob( prefix, jobId, parentKey, removeChildren)
54
55
  local prev = removeJobFromAnyState(prefix, jobId)
55
56
 
56
57
  if rcall("DEL", jobKey, jobKey .. ":logs", jobKey .. ":dependencies", jobKey .. ":processed") > 0 then
57
- local maxEvents = rcall("HGET", prefix .. "meta", "opts.maxLenEvents") or 10000
58
+ local maxEvents = getOrSetMaxEvents(prefix .. "meta")
58
59
  rcall("XADD", prefix .. "events", "MAXLEN", "~", maxEvents, "*", "event", "removed",
59
60
  "jobId", jobId, "prev", prev)
60
61
  end
@@ -31,6 +31,7 @@ local rcall = redis.call
31
31
 
32
32
  -- Includes
33
33
  --- @include "includes/addJobWithPriority"
34
+ --- @include "includes/getOrSetMaxEvents"
34
35
  --- @include "includes/getTargetQueueList"
35
36
  --- @include "includes/promoteDelayedJobs"
36
37
 
@@ -65,7 +66,7 @@ if rcall("EXISTS", KEYS[4]) == 1 then
65
66
 
66
67
  rcall("HINCRBY", KEYS[4], "atm", 1)
67
68
 
68
- local maxEvents = rcall("HGET", KEYS[5], "opts.maxLenEvents") or 10000
69
+ local maxEvents = getOrSetMaxEvents(KEYS[5])
69
70
 
70
71
  -- Emit waiting event
71
72
  rcall("XADD", KEYS[6], "MAXLEN", "~", maxEvents, "*", "event", "waiting",
@@ -18,8 +18,11 @@
18
18
  ]]
19
19
  local rcall = redis.call
20
20
 
21
+ -- Includes
22
+ --- @include "includes/getOrSetMaxEvents"
23
+
21
24
  if rcall("EXISTS", KEYS[1]) == 1 then -- // Make sure job exists
22
- local maxEvents = rcall("HGET", KEYS[3], "opts.maxLenEvents") or 10000
25
+ local maxEvents = getOrSetMaxEvents(KEYS[3])
23
26
 
24
27
  rcall("HSET", KEYS[1], "progress", ARGV[2])
25
28
  rcall("XADD", KEYS[2], "MAXLEN", "~", maxEvents, "*", "event", "progress",
@@ -44,38 +44,13 @@ local repeatJobKey = args[9]
44
44
  local parent = args[8]
45
45
  local parentData
46
46
  -- Includes
47
- --[[
48
- Function to store a job
49
- ]]
50
- local function storeJob(eventsKey, jobIdKey, jobId, name, data, opts, timestamp,
51
- parentKey, parentData, repeatJobKey)
52
- local jsonOpts = cjson.encode(opts)
53
- local delay = opts['delay'] or 0
54
- local priority = opts['priority'] or 0
55
- local optionalValues = {}
56
- if parentKey ~= nil then
57
- table.insert(optionalValues, "parentKey")
58
- table.insert(optionalValues, parentKey)
59
- table.insert(optionalValues, "parent")
60
- table.insert(optionalValues, parentData)
61
- end
62
- if repeatJobKey ~= nil then
63
- table.insert(optionalValues, "rjk")
64
- table.insert(optionalValues, repeatJobKey)
65
- end
66
- rcall("HMSET", jobIdKey, "name", name, "data", data, "opts", jsonOpts,
67
- "timestamp", timestamp, "delay", delay, "priority", priority,
68
- unpack(optionalValues))
69
- rcall("XADD", eventsKey, "*", "event", "added", "jobId", jobId, "name", name)
70
- return delay, priority
71
- end
72
47
  --[[
73
48
  Add delay marker if needed.
74
49
  ]]
75
50
  -- Includes
76
51
  --[[
77
52
  Function to return the next delayed job timestamp.
78
- ]]
53
+ ]]
79
54
  local function getNextDelayedTimestamp(delayedKey)
80
55
  local result = rcall("ZRANGE", delayedKey, 0, 0, "WITHSCORES")
81
56
  if #result then
@@ -94,6 +69,17 @@ local function addDelayMarkerIfNeeded(markerKey, delayedKey)
94
69
  rcall("ZADD", markerKey, nextTimestamp, "0")
95
70
  end
96
71
  end
72
+ --[[
73
+ Function to get max events value or set by default 10000.
74
+ ]]
75
+ local function getOrSetMaxEvents(metaKey)
76
+ local maxEvents = rcall("HGET", metaKey, "opts.maxLenEvents")
77
+ if not maxEvents then
78
+ maxEvents = 10000
79
+ rcall("HSET", metaKey, "opts.maxLenEvents", maxEvents)
80
+ end
81
+ return maxEvents
82
+ end
97
83
  --[[
98
84
  Function to check for the meta.paused key to decide if we are paused or not
99
85
  (since an empty list and !EXISTS are not really the same).
@@ -101,6 +87,38 @@ end
101
87
  local function isQueuePaused(queueMetaKey)
102
88
  return rcall("HEXISTS", queueMetaKey, "paused") == 1
103
89
  end
90
+ --[[
91
+ Function to store a job
92
+ ]]
93
+ local function storeJob(eventsKey, jobIdKey, jobId, name, data, opts, timestamp,
94
+ parentKey, parentData, repeatJobKey)
95
+ local jsonOpts = cjson.encode(opts)
96
+ local delay = opts['delay'] or 0
97
+ local priority = opts['priority'] or 0
98
+ local optionalValues = {}
99
+ if parentKey ~= nil then
100
+ table.insert(optionalValues, "parentKey")
101
+ table.insert(optionalValues, parentKey)
102
+ table.insert(optionalValues, "parent")
103
+ table.insert(optionalValues, parentData)
104
+ end
105
+ if repeatJobKey ~= nil then
106
+ table.insert(optionalValues, "rjk")
107
+ table.insert(optionalValues, repeatJobKey)
108
+ end
109
+ rcall("HMSET", jobIdKey, "name", name, "data", data, "opts", jsonOpts,
110
+ "timestamp", timestamp, "delay", delay, "priority", priority,
111
+ unpack(optionalValues))
112
+ rcall("XADD", eventsKey, "*", "event", "added", "jobId", jobId, "name", name)
113
+ return delay, priority
114
+ end
115
+ --[[
116
+ This function is used to update the parent's dependencies if the job
117
+ is already completed and about to be ignored. The parent must get its
118
+ dependencies updated to avoid the parent job being stuck forever in
119
+ the waiting-children state.
120
+ ]]
121
+ -- Includes
104
122
  --[[
105
123
  Validate and move or add dependencies to parent.
106
124
  ]]
@@ -176,12 +194,6 @@ local function updateParentDepsIfNeeded(parentKey, parentQueueKey, parentDepende
176
194
  rcall("HSET", processedSet, jobIdKey, returnvalue)
177
195
  moveParentToWaitIfNeeded(parentQueueKey, parentDependenciesKey, parentKey, parentId, timestamp)
178
196
  end
179
- --[[
180
- This function is used to update the parent's dependencies if the job
181
- is already completed and about to be ignored. The parent must get its
182
- dependencies updated to avoid the parent job being stuck forever in
183
- the waiting-children state.
184
- ]]
185
197
  local function updateExistingJobsParent(parentKey, parent, parentData,
186
198
  parentDependenciesKey, completedKey,
187
199
  jobIdKey, jobId, timestamp)
@@ -199,14 +211,6 @@ local function updateExistingJobsParent(parentKey, parent, parentData,
199
211
  rcall("HMSET", jobIdKey, "parentKey", parentKey, "parent", parentData)
200
212
  end
201
213
  end
202
- local function getOrSetMaxEvents(metaKey)
203
- local maxEvents = rcall("HGET", metaKey, "opts.maxLenEvents")
204
- if not maxEvents then
205
- maxEvents = 10000
206
- rcall("HSET", metaKey, "opts.maxLenEvents", maxEvents)
207
- end
208
- return maxEvents
209
- end
210
214
  if parentKey ~= nil then
211
215
  if rcall("EXISTS", parentKey) ~= 1 then return -5 end
212
216
  parentData = cjson.encode(parent)
@@ -1 +1 @@
1
- {"version":3,"file":"addDelayedJob-6.js","sourceRoot":"","sources":["../../../src/scripts/addDelayedJob-6.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8Pf,CAAC;AACF,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,IAAI,EAAE,eAAe;IACrB,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
1
+ {"version":3,"file":"addDelayedJob-6.js","sourceRoot":"","sources":["../../../src/scripts/addDelayedJob-6.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkQf,CAAC;AACF,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,IAAI,EAAE,eAAe;IACrB,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
@@ -64,6 +64,13 @@ local function storeJob(eventsKey, jobIdKey, jobId, name, data, opts, timestamp,
64
64
  rcall("XADD", eventsKey, "*", "event", "added", "jobId", jobId, "name", name)
65
65
  return delay, priority
66
66
  end
67
+ --[[
68
+ This function is used to update the parent's dependencies if the job
69
+ is already completed and about to be ignored. The parent must get its
70
+ dependencies updated to avoid the parent job being stuck forever in
71
+ the waiting-children state.
72
+ ]]
73
+ -- Includes
67
74
  --[[
68
75
  Validate and move or add dependencies to parent.
69
76
  ]]
@@ -78,7 +85,7 @@ end
78
85
  -- Includes
79
86
  --[[
80
87
  Function to return the next delayed job timestamp.
81
- ]]
88
+ ]]
82
89
  local function getNextDelayedTimestamp(delayedKey)
83
90
  local result = rcall("ZRANGE", delayedKey, 0, 0, "WITHSCORES")
84
91
  if #result then
@@ -171,12 +178,6 @@ local function updateParentDepsIfNeeded(parentKey, parentQueueKey, parentDepende
171
178
  rcall("HSET", processedSet, jobIdKey, returnvalue)
172
179
  moveParentToWaitIfNeeded(parentQueueKey, parentDependenciesKey, parentKey, parentId, timestamp)
173
180
  end
174
- --[[
175
- This function is used to update the parent's dependencies if the job
176
- is already completed and about to be ignored. The parent must get its
177
- dependencies updated to avoid the parent job being stuck forever in
178
- the waiting-children state.
179
- ]]
180
181
  local function updateExistingJobsParent(parentKey, parent, parentData,
181
182
  parentDependenciesKey, completedKey,
182
183
  jobIdKey, jobId, timestamp)
@@ -194,6 +195,9 @@ local function updateExistingJobsParent(parentKey, parent, parentData,
194
195
  rcall("HMSET", jobIdKey, "parentKey", parentKey, "parent", parentData)
195
196
  end
196
197
  end
198
+ --[[
199
+ Function to get max events value or set by default 10000.
200
+ ]]
197
201
  local function getOrSetMaxEvents(metaKey)
198
202
  local maxEvents = rcall("HGET", metaKey, "opts.maxLenEvents")
199
203
  if not maxEvents then
@@ -1 +1 @@
1
- {"version":3,"file":"addParentJob-4.js","sourceRoot":"","sources":["../../../src/scripts/addParentJob-4.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+Of,CAAC;AACF,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,IAAI,EAAE,cAAc;IACpB,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
1
+ {"version":3,"file":"addParentJob-4.js","sourceRoot":"","sources":["../../../src/scripts/addParentJob-4.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmPf,CAAC;AACF,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,IAAI,EAAE,cAAc;IACpB,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
@@ -87,6 +87,13 @@ local function addJobWithPriority(markerKey, prioritizedKey, priority, jobId, pr
87
87
  rcall("ZADD", markerKey, 0, "0")
88
88
  end
89
89
  end
90
+ --[[
91
+ This function is used to update the parent's dependencies if the job
92
+ is already completed and about to be ignored. The parent must get its
93
+ dependencies updated to avoid the parent job being stuck forever in
94
+ the waiting-children state.
95
+ ]]
96
+ -- Includes
90
97
  --[[
91
98
  Validate and move or add dependencies to parent.
92
99
  ]]
@@ -101,7 +108,7 @@ end
101
108
  -- Includes
102
109
  --[[
103
110
  Function to return the next delayed job timestamp.
104
- ]]
111
+ ]]
105
112
  local function getNextDelayedTimestamp(delayedKey)
106
113
  local result = rcall("ZRANGE", delayedKey, 0, 0, "WITHSCORES")
107
114
  if #result then
@@ -176,12 +183,6 @@ local function updateParentDepsIfNeeded(parentKey, parentQueueKey, parentDepende
176
183
  rcall("HSET", processedSet, jobIdKey, returnvalue)
177
184
  moveParentToWaitIfNeeded(parentQueueKey, parentDependenciesKey, parentKey, parentId, timestamp)
178
185
  end
179
- --[[
180
- This function is used to update the parent's dependencies if the job
181
- is already completed and about to be ignored. The parent must get its
182
- dependencies updated to avoid the parent job being stuck forever in
183
- the waiting-children state.
184
- ]]
185
186
  local function updateExistingJobsParent(parentKey, parent, parentData,
186
187
  parentDependenciesKey, completedKey,
187
188
  jobIdKey, jobId, timestamp)
@@ -199,6 +200,9 @@ local function updateExistingJobsParent(parentKey, parent, parentData,
199
200
  rcall("HMSET", jobIdKey, "parentKey", parentKey, "parent", parentData)
200
201
  end
201
202
  end
203
+ --[[
204
+ Function to get max events value or set by default 10000.
205
+ ]]
202
206
  local function getOrSetMaxEvents(metaKey)
203
207
  local maxEvents = rcall("HGET", metaKey, "opts.maxLenEvents")
204
208
  if not maxEvents then
@@ -1 +1 @@
1
- {"version":3,"file":"addPrioritizedJob-7.js","sourceRoot":"","sources":["../../../src/scripts/addPrioritizedJob-7.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuPf,CAAC;AACF,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,IAAI,EAAE,mBAAmB;IACzB,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
1
+ {"version":3,"file":"addPrioritizedJob-7.js","sourceRoot":"","sources":["../../../src/scripts/addPrioritizedJob-7.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2Pf,CAAC;AACF,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,IAAI,EAAE,mBAAmB;IACzB,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
@@ -73,6 +73,13 @@ local function storeJob(eventsKey, jobIdKey, jobId, name, data, opts, timestamp,
73
73
  rcall("XADD", eventsKey, "*", "event", "added", "jobId", jobId, "name", name)
74
74
  return delay, priority
75
75
  end
76
+ --[[
77
+ This function is used to update the parent's dependencies if the job
78
+ is already completed and about to be ignored. The parent must get its
79
+ dependencies updated to avoid the parent job being stuck forever in
80
+ the waiting-children state.
81
+ ]]
82
+ -- Includes
76
83
  --[[
77
84
  Validate and move or add dependencies to parent.
78
85
  ]]
@@ -87,7 +94,7 @@ end
87
94
  -- Includes
88
95
  --[[
89
96
  Function to return the next delayed job timestamp.
90
- ]]
97
+ ]]
91
98
  local function getNextDelayedTimestamp(delayedKey)
92
99
  local result = rcall("ZRANGE", delayedKey, 0, 0, "WITHSCORES")
93
100
  if #result then
@@ -180,12 +187,6 @@ local function updateParentDepsIfNeeded(parentKey, parentQueueKey, parentDepende
180
187
  rcall("HSET", processedSet, jobIdKey, returnvalue)
181
188
  moveParentToWaitIfNeeded(parentQueueKey, parentDependenciesKey, parentKey, parentId, timestamp)
182
189
  end
183
- --[[
184
- This function is used to update the parent's dependencies if the job
185
- is already completed and about to be ignored. The parent must get its
186
- dependencies updated to avoid the parent job being stuck forever in
187
- the waiting-children state.
188
- ]]
189
190
  local function updateExistingJobsParent(parentKey, parent, parentData,
190
191
  parentDependenciesKey, completedKey,
191
192
  jobIdKey, jobId, timestamp)
@@ -203,6 +204,9 @@ local function updateExistingJobsParent(parentKey, parent, parentData,
203
204
  rcall("HMSET", jobIdKey, "parentKey", parentKey, "parent", parentData)
204
205
  end
205
206
  end
207
+ --[[
208
+ Function to get max events value or set by default 10000.
209
+ ]]
206
210
  local function getOrSetMaxEvents(metaKey)
207
211
  local maxEvents = rcall("HGET", metaKey, "opts.maxLenEvents")
208
212
  if not maxEvents then
@@ -1 +1 @@
1
- {"version":3,"file":"addStandardJob-7.js","sourceRoot":"","sources":["../../../src/scripts/addStandardJob-7.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgQf,CAAC;AACF,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,IAAI,EAAE,gBAAgB;IACtB,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
1
+ {"version":3,"file":"addStandardJob-7.js","sourceRoot":"","sources":["../../../src/scripts/addStandardJob-7.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoQf,CAAC;AACF,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,IAAI,EAAE,gBAAgB;IACtB,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
@@ -197,10 +197,12 @@ local function batches(n, batchSize)
197
197
  end
198
198
  end
199
199
  end
200
- -- We use ZRANGEBYSCORE to make the case where we're deleting a limited number
201
- -- of items in a sorted set only run a single iteration. If we simply used
202
- -- ZRANGE, we may take a long time traversing through jobs that are within the
203
- -- grace period.
200
+ --[[
201
+ We use ZRANGEBYSCORE to make the case where we're deleting a limited number
202
+ of items in a sorted set only run a single iteration. If we simply used
203
+ ZRANGE, we may take a long time traversing through jobs that are within the
204
+ grace period.
205
+ ]]
204
206
  local function getJobsInZset(zsetKey, rangeEnd, limit)
205
207
  if limit > 0 then
206
208
  return rcall("ZRANGEBYSCORE", zsetKey, 0, rangeEnd, "LIMIT", 0, limit)
@@ -1 +1 @@
1
- {"version":3,"file":"cleanJobsInSet-2.js","sourceRoot":"","sources":["../../../src/scripts/cleanJobsInSet-2.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqQf,CAAC;AACF,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,IAAI,EAAE,gBAAgB;IACtB,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
1
+ {"version":3,"file":"cleanJobsInSet-2.js","sourceRoot":"","sources":["../../../src/scripts/cleanJobsInSet-2.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuQf,CAAC;AACF,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,IAAI,EAAE,gBAAgB;IACtB,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
@@ -35,6 +35,17 @@ local function batches(n, batchSize)
35
35
  end
36
36
  end
37
37
  end
38
+ --[[
39
+ Function to get max events value or set by default 10000.
40
+ ]]
41
+ local function getOrSetMaxEvents(metaKey)
42
+ local maxEvents = rcall("HGET", metaKey, "opts.maxLenEvents")
43
+ if not maxEvents then
44
+ maxEvents = 10000
45
+ rcall("HSET", metaKey, "opts.maxLenEvents", maxEvents)
46
+ end
47
+ return maxEvents
48
+ end
38
49
  --[[
39
50
  Function to check for the meta.paused key to decide if we are paused or not
40
51
  (since an empty list and !EXISTS are not really the same).
@@ -61,7 +72,7 @@ if (#jobs > 0) then
61
72
  rcall("HDEL", jobKey, "finishedOn", "processedOn", "returnvalue")
62
73
  end
63
74
  end
64
- local maxEvents = rcall("HGET", metaKey, "opts.maxLenEvents") or 10000
75
+ local maxEvents = getOrSetMaxEvents(metaKey)
65
76
  for i, key in ipairs(jobs) do
66
77
  -- Emit waiting event
67
78
  rcall("XADD", KEYS[2], "MAXLEN", "~", maxEvents, "*", "event",
@@ -1 +1 @@
1
- {"version":3,"file":"moveJobsToWait-6.js","sourceRoot":"","sources":["../../../src/scripts/moveJobsToWait-6.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6Ef,CAAC;AACF,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,IAAI,EAAE,gBAAgB;IACtB,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
1
+ {"version":3,"file":"moveJobsToWait-6.js","sourceRoot":"","sources":["../../../src/scripts/moveJobsToWait-6.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwFf,CAAC;AACF,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,IAAI,EAAE,gBAAgB;IACtB,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
@@ -177,8 +177,20 @@ end
177
177
  --[[
178
178
  Function to trim events, default 10000.
179
179
  ]]
180
+ -- Includes
181
+ --[[
182
+ Function to get max events value or set by default 10000.
183
+ ]]
184
+ local function getOrSetMaxEvents(metaKey)
185
+ local maxEvents = rcall("HGET", metaKey, "opts.maxLenEvents")
186
+ if not maxEvents then
187
+ maxEvents = 10000
188
+ rcall("HSET", metaKey, "opts.maxLenEvents", maxEvents)
189
+ end
190
+ return maxEvents
191
+ end
180
192
  local function trimEvents(metaKey, eventStreamKey)
181
- local maxEvents = rcall("HGET", metaKey, "opts.maxLenEvents")
193
+ local maxEvents = getOrSetMaxEvents(metaKey)
182
194
  if maxEvents ~= false then
183
195
  rcall("XTRIM", eventStreamKey, "MAXLEN", "~", maxEvents)
184
196
  else
@@ -1 +1 @@
1
- {"version":3,"file":"moveStalledJobsToWait-8.js","sourceRoot":"","sources":["../../../src/scripts/moveStalledJobsToWait-8.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwRf,CAAC;AACF,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,IAAI,EAAE,uBAAuB;IAC7B,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
1
+ {"version":3,"file":"moveStalledJobsToWait-8.js","sourceRoot":"","sources":["../../../src/scripts/moveStalledJobsToWait-8.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoSf,CAAC;AACF,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,IAAI,EAAE,uBAAuB;IAC7B,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
@@ -36,7 +36,7 @@ local opts = cmsgpack.unpack(ARGV[3])
36
36
  -- Includes
37
37
  --[[
38
38
  Function to return the next delayed job timestamp.
39
- ]]
39
+ ]]
40
40
  local function getNextDelayedTimestamp(delayedKey)
41
41
  local result = rcall("ZRANGE", delayedKey, 0, 0, "WITHSCORES")
42
42
  if #result then
@@ -47,6 +47,9 @@ local function getNextDelayedTimestamp(delayedKey)
47
47
  return nextTimestamp
48
48
  end
49
49
  end
50
+ --[[
51
+ Function to get current rate limit ttl.
52
+ ]]
50
53
  local function getRateLimitTTL(maxJobs, rateLimiterKey)
51
54
  if maxJobs and maxJobs <= tonumber(rcall("GET", rateLimiterKey) or 0) then
52
55
  local pttl = rcall("PTTL", rateLimiterKey)
@@ -1 +1 @@
1
- {"version":3,"file":"moveToActive-11.js","sourceRoot":"","sources":["../../../src/scripts/moveToActive-11.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiOf,CAAC;AACF,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,IAAI,EAAE,cAAc;IACpB,OAAO;IACP,IAAI,EAAE,EAAE;CACT,CAAC"}
1
+ {"version":3,"file":"moveToActive-11.js","sourceRoot":"","sources":["../../../src/scripts/moveToActive-11.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoOf,CAAC;AACF,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,IAAI,EAAE,cAAc;IACpB,OAAO;IACP,IAAI,EAAE,EAAE;CACT,CAAC"}
@@ -30,7 +30,7 @@ local rcall = redis.call
30
30
  -- Includes
31
31
  --[[
32
32
  Function to return the next delayed job timestamp.
33
- ]]
33
+ ]]
34
34
  local function getNextDelayedTimestamp(delayedKey)
35
35
  local result = rcall("ZRANGE", delayedKey, 0, 0, "WITHSCORES")
36
36
  if #result then
@@ -49,6 +49,17 @@ local function addDelayMarkerIfNeeded(markerKey, delayedKey)
49
49
  rcall("ZADD", markerKey, nextTimestamp, "0")
50
50
  end
51
51
  end
52
+ --[[
53
+ Function to get max events value or set by default 10000.
54
+ ]]
55
+ local function getOrSetMaxEvents(metaKey)
56
+ local maxEvents = rcall("HGET", metaKey, "opts.maxLenEvents")
57
+ if not maxEvents then
58
+ maxEvents = 10000
59
+ rcall("HSET", metaKey, "opts.maxLenEvents", maxEvents)
60
+ end
61
+ return maxEvents
62
+ end
52
63
  --[[
53
64
  Function to check for the meta.paused key to decide if we are paused or not
54
65
  (since an empty list and !EXISTS are not really the same).
@@ -77,7 +88,7 @@ if rcall("EXISTS", jobKey) == 1 then
77
88
  rcall("HINCRBY", jobKey, "atm", 1)
78
89
  end
79
90
  rcall("HSET", jobKey, "delay", ARGV[6])
80
- local maxEvents = rcall("HGET", metaKey, "opts.maxLenEvents") or 10000
91
+ local maxEvents = getOrSetMaxEvents(metaKey)
81
92
  rcall("ZADD", delayedKey, score, jobId)
82
93
  rcall("XADD", KEYS[6], "MAXLEN", "~", maxEvents, "*", "event", "delayed",
83
94
  "jobId", jobId, "delay", delayedTimestamp)
@@ -1 +1 @@
1
- {"version":3,"file":"moveToDelayed-7.js","sourceRoot":"","sources":["../../../src/scripts/moveToDelayed-7.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6Ff,CAAC;AACF,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,IAAI,EAAE,eAAe;IACrB,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
1
+ {"version":3,"file":"moveToDelayed-7.js","sourceRoot":"","sources":["../../../src/scripts/moveToDelayed-7.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwGf,CAAC;AACF,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,IAAI,EAAE,eAAe;IACrB,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
@@ -102,7 +102,7 @@ local function collectMetrics(metaKey, dataPointsList, maxDataPoints,
102
102
  end
103
103
  --[[
104
104
  Function to return the next delayed job timestamp.
105
- ]]
105
+ ]]
106
106
  local function getNextDelayedTimestamp(delayedKey)
107
107
  local result = rcall("ZRANGE", delayedKey, 0, 0, "WITHSCORES")
108
108
  if #result then
@@ -454,8 +454,20 @@ end
454
454
  --[[
455
455
  Function to trim events, default 10000.
456
456
  ]]
457
+ -- Includes
458
+ --[[
459
+ Function to get max events value or set by default 10000.
460
+ ]]
461
+ local function getOrSetMaxEvents(metaKey)
462
+ local maxEvents = rcall("HGET", metaKey, "opts.maxLenEvents")
463
+ if not maxEvents then
464
+ maxEvents = 10000
465
+ rcall("HSET", metaKey, "opts.maxLenEvents", maxEvents)
466
+ end
467
+ return maxEvents
468
+ end
457
469
  local function trimEvents(metaKey, eventStreamKey)
458
- local maxEvents = rcall("HGET", metaKey, "opts.maxLenEvents")
470
+ local maxEvents = getOrSetMaxEvents(metaKey)
459
471
  if maxEvents ~= false then
460
472
  rcall("XTRIM", eventStreamKey, "MAXLEN", "~", maxEvents)
461
473
  else
@@ -472,6 +484,9 @@ local function updateParentDepsIfNeeded(parentKey, parentQueueKey, parentDepende
472
484
  rcall("HSET", processedSet, jobIdKey, returnvalue)
473
485
  moveParentToWaitIfNeeded(parentQueueKey, parentDependenciesKey, parentKey, parentId, timestamp)
474
486
  end
487
+ --[[
488
+ Function to get current rate limit ttl.
489
+ ]]
475
490
  local function getRateLimitTTL(maxJobs, rateLimiterKey)
476
491
  if maxJobs and maxJobs <= tonumber(rcall("GET", rateLimiterKey) or 0) then
477
492
  local pttl = rcall("PTTL", rateLimiterKey)
@@ -1 +1 @@
1
- {"version":3,"file":"moveToFinished-14.js","sourceRoot":"","sources":["../../../src/scripts/moveToFinished-14.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAipBf,CAAC;AACF,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,IAAI,EAAE,gBAAgB;IACtB,OAAO;IACP,IAAI,EAAE,EAAE;CACT,CAAC"}
1
+ {"version":3,"file":"moveToFinished-14.js","sourceRoot":"","sources":["../../../src/scripts/moveToFinished-14.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgqBf,CAAC;AACF,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,IAAI,EAAE,gBAAgB;IACtB,OAAO;IACP,IAAI,EAAE,EAAE;CACT,CAAC"}
@@ -20,7 +20,7 @@ local rcall = redis.call
20
20
  -- Includes
21
21
  --[[
22
22
  Function to return the next delayed job timestamp.
23
- ]]
23
+ ]]
24
24
  local function getNextDelayedTimestamp(delayedKey)
25
25
  local result = rcall("ZRANGE", delayedKey, 0, 0, "WITHSCORES")
26
26
  if #result then
@@ -20,6 +20,17 @@ end
20
20
  local getJobKeyPrefix = function (jobKey, jobId)
21
21
  return string.sub(jobKey, 0, #jobKey - #jobId)
22
22
  end
23
+ --[[
24
+ Function to get max events value or set by default 10000.
25
+ ]]
26
+ local function getOrSetMaxEvents(metaKey)
27
+ local maxEvents = rcall("HGET", metaKey, "opts.maxLenEvents")
28
+ if not maxEvents then
29
+ maxEvents = 10000
30
+ rcall("HSET", metaKey, "opts.maxLenEvents", maxEvents)
31
+ end
32
+ return maxEvents
33
+ end
23
34
  --[[
24
35
  Function to recursively check if there are no locks
25
36
  on the jobs to be removed.
@@ -188,7 +199,7 @@ local function removeJob( prefix, jobId, parentKey, removeChildren)
188
199
  end
189
200
  local prev = removeJobFromAnyState(prefix, jobId)
190
201
  if rcall("DEL", jobKey, jobKey .. ":logs", jobKey .. ":dependencies", jobKey .. ":processed") > 0 then
191
- local maxEvents = rcall("HGET", prefix .. "meta", "opts.maxLenEvents") or 10000
202
+ local maxEvents = getOrSetMaxEvents(prefix .. "meta")
192
203
  rcall("XADD", prefix .. "events", "MAXLEN", "~", maxEvents, "*", "event", "removed",
193
204
  "jobId", jobId, "prev", prev)
194
205
  end
@@ -1 +1 @@
1
- {"version":3,"file":"removeJob-1.js","sourceRoot":"","sources":["../../../src/scripts/removeJob-1.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyMf,CAAC;AACF,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,IAAI,EAAE,WAAW;IACjB,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
1
+ {"version":3,"file":"removeJob-1.js","sourceRoot":"","sources":["../../../src/scripts/removeJob-1.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoNf,CAAC;AACF,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,IAAI,EAAE,WAAW;IACjB,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}