bullmq 5.55.0 → 5.56.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 (82) hide show
  1. package/dist/cjs/classes/scripts.js +3 -0
  2. package/dist/cjs/classes/scripts.js.map +1 -1
  3. package/dist/cjs/classes/worker.js +4 -3
  4. package/dist/cjs/classes/worker.js.map +1 -1
  5. package/dist/cjs/commands/addDelayedJob-6.lua +2 -2
  6. package/dist/cjs/commands/{addParentJob-4.lua → addParentJob-5.lua} +7 -6
  7. package/dist/cjs/commands/{addPrioritizedJob-8.lua → addPrioritizedJob-9.lua} +11 -10
  8. package/dist/{esm/commands/addStandardJob-8.lua → cjs/commands/addStandardJob-9.lua} +9 -8
  9. package/dist/cjs/commands/includes/collectMetrics.lua +1 -1
  10. package/dist/cjs/commands/includes/deduplicateJob.lua +66 -20
  11. package/dist/cjs/commands/includes/prepareJobForProcessing.lua +2 -1
  12. package/dist/cjs/commands/includes/storeJob.lua +1 -1
  13. package/dist/cjs/interfaces/index.js +0 -1
  14. package/dist/cjs/interfaces/index.js.map +1 -1
  15. package/dist/cjs/scripts/addDelayedJob-6.js +71 -22
  16. package/dist/cjs/scripts/addDelayedJob-6.js.map +1 -1
  17. package/dist/cjs/scripts/{addParentJob-4.js → addParentJob-5.js} +78 -28
  18. package/dist/cjs/scripts/addParentJob-5.js.map +1 -0
  19. package/dist/cjs/scripts/{addPrioritizedJob-8.js → addPrioritizedJob-9.js} +82 -32
  20. package/dist/cjs/scripts/{addPrioritizedJob-8.js.map → addPrioritizedJob-9.js.map} +1 -1
  21. package/dist/cjs/scripts/{addStandardJob-8.js → addStandardJob-9.js} +80 -30
  22. package/dist/cjs/scripts/{addStandardJob-8.js.map → addStandardJob-9.js.map} +1 -1
  23. package/dist/cjs/scripts/index.js +3 -3
  24. package/dist/cjs/scripts/moveToActive-11.js +2 -0
  25. package/dist/cjs/scripts/moveToActive-11.js.map +1 -1
  26. package/dist/cjs/scripts/moveToFinished-14.js +3 -1
  27. package/dist/cjs/scripts/moveToFinished-14.js.map +1 -1
  28. package/dist/cjs/tsconfig-cjs.tsbuildinfo +1 -1
  29. package/dist/cjs/{interfaces/debounce-options.js → types/deduplication-options.js} +1 -1
  30. package/dist/cjs/types/deduplication-options.js.map +1 -0
  31. package/dist/cjs/types/index.js +1 -0
  32. package/dist/cjs/types/index.js.map +1 -1
  33. package/dist/cjs/version.js +1 -1
  34. package/dist/esm/classes/scripts.js +3 -0
  35. package/dist/esm/classes/scripts.js.map +1 -1
  36. package/dist/esm/classes/worker.js +4 -3
  37. package/dist/esm/classes/worker.js.map +1 -1
  38. package/dist/esm/commands/addDelayedJob-6.lua +2 -2
  39. package/dist/esm/commands/{addParentJob-4.lua → addParentJob-5.lua} +7 -6
  40. package/dist/esm/commands/{addPrioritizedJob-8.lua → addPrioritizedJob-9.lua} +11 -10
  41. package/dist/{cjs/commands/addStandardJob-8.lua → esm/commands/addStandardJob-9.lua} +9 -8
  42. package/dist/esm/commands/includes/collectMetrics.lua +1 -1
  43. package/dist/esm/commands/includes/deduplicateJob.lua +66 -20
  44. package/dist/esm/commands/includes/prepareJobForProcessing.lua +2 -1
  45. package/dist/esm/commands/includes/storeJob.lua +1 -1
  46. package/dist/esm/interfaces/index.d.ts +0 -1
  47. package/dist/esm/interfaces/index.js +0 -1
  48. package/dist/esm/interfaces/index.js.map +1 -1
  49. package/dist/esm/scripts/addDelayedJob-6.js +71 -22
  50. package/dist/esm/scripts/addDelayedJob-6.js.map +1 -1
  51. package/dist/esm/scripts/{addParentJob-4.js → addParentJob-5.js} +78 -28
  52. package/dist/esm/scripts/addParentJob-5.js.map +1 -0
  53. package/dist/esm/scripts/{addPrioritizedJob-8.js → addPrioritizedJob-9.js} +82 -32
  54. package/dist/esm/scripts/{addPrioritizedJob-8.js.map → addPrioritizedJob-9.js.map} +1 -1
  55. package/dist/esm/scripts/{addStandardJob-8.js → addStandardJob-9.js} +80 -30
  56. package/dist/esm/scripts/{addStandardJob-8.js.map → addStandardJob-9.js.map} +1 -1
  57. package/dist/esm/scripts/index.d.ts +3 -3
  58. package/dist/esm/scripts/index.js +3 -3
  59. package/dist/esm/scripts/moveToActive-11.js +2 -0
  60. package/dist/esm/scripts/moveToActive-11.js.map +1 -1
  61. package/dist/esm/scripts/moveToFinished-14.js +3 -1
  62. package/dist/esm/scripts/moveToFinished-14.js.map +1 -1
  63. package/dist/esm/tsconfig.tsbuildinfo +1 -1
  64. package/dist/esm/types/deduplication-options.d.ts +22 -0
  65. package/dist/esm/types/deduplication-options.js +2 -0
  66. package/dist/esm/types/deduplication-options.js.map +1 -0
  67. package/dist/esm/types/index.d.ts +1 -0
  68. package/dist/esm/types/index.js +1 -0
  69. package/dist/esm/types/index.js.map +1 -1
  70. package/dist/esm/types/job-options.d.ts +6 -6
  71. package/dist/esm/version.d.ts +1 -1
  72. package/dist/esm/version.js +1 -1
  73. package/package.json +2 -5
  74. package/dist/cjs/interfaces/debounce-options.js.map +0 -1
  75. package/dist/cjs/scripts/addParentJob-4.js.map +0 -1
  76. package/dist/esm/interfaces/debounce-options.d.ts +0 -13
  77. package/dist/esm/interfaces/debounce-options.js +0 -2
  78. package/dist/esm/interfaces/debounce-options.js.map +0 -1
  79. package/dist/esm/scripts/addParentJob-4.js.map +0 -1
  80. /package/dist/esm/scripts/{addParentJob-4.d.ts → addParentJob-5.d.ts} +0 -0
  81. /package/dist/esm/scripts/{addPrioritizedJob-8.d.ts → addPrioritizedJob-9.d.ts} +0 -0
  82. /package/dist/esm/scripts/{addStandardJob-8.d.ts → addStandardJob-9.d.ts} +0 -0
@@ -111,26 +111,75 @@ local function addDelayedJob(jobId, delayedKey, eventsKey, timestamp,
111
111
  end
112
112
  --[[
113
113
  Function to debounce a job.
114
- ]]
115
- local function deduplicateJob(deduplicationOpts, jobId, deduplicationKey, eventsKey, maxEvents)
116
- local deduplicationId = deduplicationOpts and deduplicationOpts['id']
117
- if deduplicationId then
118
- local ttl = deduplicationOpts['ttl']
119
- local deduplicationKeyExists
120
- if ttl then
121
- deduplicationKeyExists = not rcall('SET', deduplicationKey, jobId, 'PX', ttl, 'NX')
122
- else
123
- deduplicationKeyExists = not rcall('SET', deduplicationKey, jobId, 'NX')
124
- end
125
- if deduplicationKeyExists then
126
- local currentDebounceJobId = rcall('GET', deduplicationKey)
127
- rcall("XADD", eventsKey, "MAXLEN", "~", maxEvents, "*", "event", "debounced", "jobId", currentDebounceJobId,
128
- "debounceId", deduplicationId)
129
- rcall("XADD", eventsKey, "MAXLEN", "~", maxEvents, "*", "event", "deduplicated", "jobId",
130
- currentDebounceJobId, "deduplicationId", deduplicationId, "deduplicatedJobId", jobId)
131
- return currentDebounceJobId
132
- end
133
- end
114
+ ]]
115
+ -- Includes
116
+ --[[
117
+ Function to remove job keys.
118
+ ]]
119
+ local function removeJobKeys(jobKey)
120
+ return rcall("DEL", jobKey, jobKey .. ':logs', jobKey .. ':dependencies',
121
+ jobKey .. ':processed', jobKey .. ':failed', jobKey .. ':unsuccessful')
122
+ end
123
+ local function deduplicateJob(deduplicationOpts, jobId, delayedKey, deduplicationKey, eventsKey, maxEvents,
124
+ prefix)
125
+ local deduplicationId = deduplicationOpts and deduplicationOpts['id']
126
+ if deduplicationId then
127
+ local ttl = deduplicationOpts['ttl']
128
+ if deduplicationOpts['replace'] and ttl and ttl > 0 then
129
+ local currentDebounceJobId = rcall('GET', deduplicationKey)
130
+ if currentDebounceJobId then
131
+ if rcall("ZREM", delayedKey, currentDebounceJobId) > 0 then
132
+ removeJobKeys(prefix .. currentDebounceJobId)
133
+ rcall("XADD", eventsKey, "*", "event", "removed", "jobId", currentDebounceJobId,
134
+ "prev", "delayed")
135
+ if deduplicationOpts['extend'] then
136
+ rcall('SET', deduplicationKey, jobId, 'PX', ttl)
137
+ else
138
+ rcall('SET', deduplicationKey, jobId, 'KEEPTTL')
139
+ end
140
+ rcall("XADD", eventsKey, "MAXLEN", "~", maxEvents, "*", "event", "deduplicated", "jobId",
141
+ jobId, "deduplicationId", deduplicationId, "deduplicatedJobId", currentDebounceJobId)
142
+ return
143
+ else
144
+ return currentDebounceJobId
145
+ end
146
+ else
147
+ rcall('SET', deduplicationKey, jobId, 'PX', ttl)
148
+ return
149
+ end
150
+ else
151
+ local ttl = deduplicationOpts['ttl']
152
+ local deduplicationKeyExists
153
+ if ttl then
154
+ if deduplicationOpts['extend'] then
155
+ local currentDebounceJobId = rcall('GET', deduplicationKey)
156
+ if currentDebounceJobId then
157
+ rcall('SET', deduplicationKey, currentDebounceJobId, 'PX', ttl)
158
+ rcall("XADD", eventsKey, "MAXLEN", "~", maxEvents, "*", "event", "debounced",
159
+ "jobId", currentDebounceJobId, "debounceId", deduplicationId)
160
+ rcall("XADD", eventsKey, "MAXLEN", "~", maxEvents, "*", "event", "deduplicated", "jobId",
161
+ currentDebounceJobId, "deduplicationId", deduplicationId, "deduplicatedJobId", jobId)
162
+ return currentDebounceJobId
163
+ else
164
+ rcall('SET', deduplicationKey, jobId, 'PX', ttl)
165
+ return
166
+ end
167
+ else
168
+ deduplicationKeyExists = not rcall('SET', deduplicationKey, jobId, 'PX', ttl, 'NX')
169
+ end
170
+ else
171
+ deduplicationKeyExists = not rcall('SET', deduplicationKey, jobId, 'NX')
172
+ end
173
+ if deduplicationKeyExists then
174
+ local currentDebounceJobId = rcall('GET', deduplicationKey)
175
+ rcall("XADD", eventsKey, "MAXLEN", "~", maxEvents, "*", "event", "debounced", "jobId",
176
+ currentDebounceJobId, "debounceId", deduplicationId)
177
+ rcall("XADD", eventsKey, "MAXLEN", "~", maxEvents, "*", "event", "deduplicated", "jobId",
178
+ currentDebounceJobId, "deduplicationId", deduplicationId, "deduplicatedJobId", jobId)
179
+ return currentDebounceJobId
180
+ end
181
+ end
182
+ end
134
183
  end
135
184
  --[[
136
185
  Function to get max events value or set by default 10000.
@@ -378,8 +427,8 @@ else
378
427
  maxEvents, timestamp)
379
428
  end
380
429
  end
381
- local deduplicationJobId = deduplicateJob(opts['de'], jobId, deduplicationKey,
382
- eventsKey, maxEvents)
430
+ local deduplicationJobId = deduplicateJob(opts['de'], jobId, delayedKey, deduplicationKey,
431
+ eventsKey, maxEvents, args[1])
383
432
  if deduplicationJobId then
384
433
  return deduplicationJobId
385
434
  end
@@ -1 +1 @@
1
- {"version":3,"file":"addDelayedJob-6.js","sourceRoot":"","sources":["../../../src/scripts/addDelayedJob-6.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyYf,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0bf,CAAC;AACF,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,IAAI,EAAE,eAAe;IACrB,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
@@ -6,8 +6,9 @@ const content = `--[[
6
6
  Input:
7
7
  KEYS[1] 'meta'
8
8
  KEYS[2] 'id'
9
- KEYS[3] 'completed'
10
- KEYS[4] events stream key
9
+ KEYS[3] 'delayed'
10
+ KEYS[4] 'completed'
11
+ KEYS[5] events stream key
11
12
  ARGV[1] msgpacked arguments array
12
13
  [1] key prefix,
13
14
  [2] custom id (will not generate one automatically)
@@ -27,8 +28,8 @@ const content = `--[[
27
28
  ]]
28
29
  local metaKey = KEYS[1]
29
30
  local idKey = KEYS[2]
30
- local completedKey = KEYS[3]
31
- local eventsKey = KEYS[4]
31
+ local completedKey = KEYS[4]
32
+ local eventsKey = KEYS[5]
32
33
  local jobId
33
34
  local jobIdKey
34
35
  local rcall = redis.call
@@ -43,26 +44,75 @@ local parentData
43
44
  -- Includes
44
45
  --[[
45
46
  Function to debounce a job.
46
- ]]
47
- local function deduplicateJob(deduplicationOpts, jobId, deduplicationKey, eventsKey, maxEvents)
48
- local deduplicationId = deduplicationOpts and deduplicationOpts['id']
49
- if deduplicationId then
50
- local ttl = deduplicationOpts['ttl']
51
- local deduplicationKeyExists
52
- if ttl then
53
- deduplicationKeyExists = not rcall('SET', deduplicationKey, jobId, 'PX', ttl, 'NX')
54
- else
55
- deduplicationKeyExists = not rcall('SET', deduplicationKey, jobId, 'NX')
56
- end
57
- if deduplicationKeyExists then
58
- local currentDebounceJobId = rcall('GET', deduplicationKey)
59
- rcall("XADD", eventsKey, "MAXLEN", "~", maxEvents, "*", "event", "debounced", "jobId", currentDebounceJobId,
60
- "debounceId", deduplicationId)
61
- rcall("XADD", eventsKey, "MAXLEN", "~", maxEvents, "*", "event", "deduplicated", "jobId",
62
- currentDebounceJobId, "deduplicationId", deduplicationId, "deduplicatedJobId", jobId)
63
- return currentDebounceJobId
64
- end
65
- end
47
+ ]]
48
+ -- Includes
49
+ --[[
50
+ Function to remove job keys.
51
+ ]]
52
+ local function removeJobKeys(jobKey)
53
+ return rcall("DEL", jobKey, jobKey .. ':logs', jobKey .. ':dependencies',
54
+ jobKey .. ':processed', jobKey .. ':failed', jobKey .. ':unsuccessful')
55
+ end
56
+ local function deduplicateJob(deduplicationOpts, jobId, delayedKey, deduplicationKey, eventsKey, maxEvents,
57
+ prefix)
58
+ local deduplicationId = deduplicationOpts and deduplicationOpts['id']
59
+ if deduplicationId then
60
+ local ttl = deduplicationOpts['ttl']
61
+ if deduplicationOpts['replace'] and ttl and ttl > 0 then
62
+ local currentDebounceJobId = rcall('GET', deduplicationKey)
63
+ if currentDebounceJobId then
64
+ if rcall("ZREM", delayedKey, currentDebounceJobId) > 0 then
65
+ removeJobKeys(prefix .. currentDebounceJobId)
66
+ rcall("XADD", eventsKey, "*", "event", "removed", "jobId", currentDebounceJobId,
67
+ "prev", "delayed")
68
+ if deduplicationOpts['extend'] then
69
+ rcall('SET', deduplicationKey, jobId, 'PX', ttl)
70
+ else
71
+ rcall('SET', deduplicationKey, jobId, 'KEEPTTL')
72
+ end
73
+ rcall("XADD", eventsKey, "MAXLEN", "~", maxEvents, "*", "event", "deduplicated", "jobId",
74
+ jobId, "deduplicationId", deduplicationId, "deduplicatedJobId", currentDebounceJobId)
75
+ return
76
+ else
77
+ return currentDebounceJobId
78
+ end
79
+ else
80
+ rcall('SET', deduplicationKey, jobId, 'PX', ttl)
81
+ return
82
+ end
83
+ else
84
+ local ttl = deduplicationOpts['ttl']
85
+ local deduplicationKeyExists
86
+ if ttl then
87
+ if deduplicationOpts['extend'] then
88
+ local currentDebounceJobId = rcall('GET', deduplicationKey)
89
+ if currentDebounceJobId then
90
+ rcall('SET', deduplicationKey, currentDebounceJobId, 'PX', ttl)
91
+ rcall("XADD", eventsKey, "MAXLEN", "~", maxEvents, "*", "event", "debounced",
92
+ "jobId", currentDebounceJobId, "debounceId", deduplicationId)
93
+ rcall("XADD", eventsKey, "MAXLEN", "~", maxEvents, "*", "event", "deduplicated", "jobId",
94
+ currentDebounceJobId, "deduplicationId", deduplicationId, "deduplicatedJobId", jobId)
95
+ return currentDebounceJobId
96
+ else
97
+ rcall('SET', deduplicationKey, jobId, 'PX', ttl)
98
+ return
99
+ end
100
+ else
101
+ deduplicationKeyExists = not rcall('SET', deduplicationKey, jobId, 'PX', ttl, 'NX')
102
+ end
103
+ else
104
+ deduplicationKeyExists = not rcall('SET', deduplicationKey, jobId, 'NX')
105
+ end
106
+ if deduplicationKeyExists then
107
+ local currentDebounceJobId = rcall('GET', deduplicationKey)
108
+ rcall("XADD", eventsKey, "MAXLEN", "~", maxEvents, "*", "event", "debounced", "jobId",
109
+ currentDebounceJobId, "debounceId", deduplicationId)
110
+ rcall("XADD", eventsKey, "MAXLEN", "~", maxEvents, "*", "event", "deduplicated", "jobId",
111
+ currentDebounceJobId, "deduplicationId", deduplicationId, "deduplicatedJobId", jobId)
112
+ return currentDebounceJobId
113
+ end
114
+ end
115
+ end
66
116
  end
67
117
  --[[
68
118
  Function to get max events value or set by default 10000.
@@ -333,8 +383,8 @@ else
333
383
  maxEvents, timestamp)
334
384
  end
335
385
  end
336
- local deduplicationJobId = deduplicateJob(opts['de'], jobId,
337
- deduplicationKey, eventsKey, maxEvents)
386
+ local deduplicationJobId = deduplicateJob(opts['de'], jobId, KEYS[3],
387
+ deduplicationKey, eventsKey, maxEvents, args[1])
338
388
  if deduplicationJobId then
339
389
  return deduplicationJobId
340
390
  end
@@ -354,6 +404,6 @@ return jobId .. "" -- convert to string
354
404
  export const addParentJob = {
355
405
  name: 'addParentJob',
356
406
  content,
357
- keys: 4,
407
+ keys: 5,
358
408
  };
359
- //# sourceMappingURL=addParentJob-4.js.map
409
+ //# sourceMappingURL=addParentJob-5.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"addParentJob-5.js","sourceRoot":"","sources":["../../../src/scripts/addParentJob-5.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkZf,CAAC;AACF,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,IAAI,EAAE,cAAc;IACpB,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
@@ -8,10 +8,11 @@ const content = `--[[
8
8
  KEYS[2] 'meta'
9
9
  KEYS[3] 'id'
10
10
  KEYS[4] 'prioritized'
11
- KEYS[5] 'completed'
12
- KEYS[6] 'active'
13
- KEYS[7] events stream key
14
- KEYS[8] 'pc' priority counter
11
+ KEYS[5] 'delayed'
12
+ KEYS[6] 'completed'
13
+ KEYS[7] 'active'
14
+ KEYS[8] events stream key
15
+ KEYS[9] 'pc' priority counter
15
16
  ARGV[1] msgpacked arguments array
16
17
  [1] key prefix,
17
18
  [2] custom id (will not generate one automatically)
@@ -32,10 +33,10 @@ const content = `--[[
32
33
  local metaKey = KEYS[2]
33
34
  local idKey = KEYS[3]
34
35
  local priorityKey = KEYS[4]
35
- local completedKey = KEYS[5]
36
- local activeKey = KEYS[6]
37
- local eventsKey = KEYS[7]
38
- local priorityCounterKey = KEYS[8]
36
+ local completedKey = KEYS[6]
37
+ local activeKey = KEYS[7]
38
+ local eventsKey = KEYS[8]
39
+ local priorityCounterKey = KEYS[9]
39
40
  local jobId
40
41
  local jobIdKey
41
42
  local rcall = redis.call
@@ -75,26 +76,75 @@ local function addJobWithPriority(markerKey, prioritizedKey, priority, jobId, pr
75
76
  end
76
77
  --[[
77
78
  Function to debounce a job.
78
- ]]
79
- local function deduplicateJob(deduplicationOpts, jobId, deduplicationKey, eventsKey, maxEvents)
80
- local deduplicationId = deduplicationOpts and deduplicationOpts['id']
81
- if deduplicationId then
82
- local ttl = deduplicationOpts['ttl']
83
- local deduplicationKeyExists
84
- if ttl then
85
- deduplicationKeyExists = not rcall('SET', deduplicationKey, jobId, 'PX', ttl, 'NX')
86
- else
87
- deduplicationKeyExists = not rcall('SET', deduplicationKey, jobId, 'NX')
88
- end
89
- if deduplicationKeyExists then
90
- local currentDebounceJobId = rcall('GET', deduplicationKey)
91
- rcall("XADD", eventsKey, "MAXLEN", "~", maxEvents, "*", "event", "debounced", "jobId", currentDebounceJobId,
92
- "debounceId", deduplicationId)
93
- rcall("XADD", eventsKey, "MAXLEN", "~", maxEvents, "*", "event", "deduplicated", "jobId",
94
- currentDebounceJobId, "deduplicationId", deduplicationId, "deduplicatedJobId", jobId)
95
- return currentDebounceJobId
96
- end
97
- end
79
+ ]]
80
+ -- Includes
81
+ --[[
82
+ Function to remove job keys.
83
+ ]]
84
+ local function removeJobKeys(jobKey)
85
+ return rcall("DEL", jobKey, jobKey .. ':logs', jobKey .. ':dependencies',
86
+ jobKey .. ':processed', jobKey .. ':failed', jobKey .. ':unsuccessful')
87
+ end
88
+ local function deduplicateJob(deduplicationOpts, jobId, delayedKey, deduplicationKey, eventsKey, maxEvents,
89
+ prefix)
90
+ local deduplicationId = deduplicationOpts and deduplicationOpts['id']
91
+ if deduplicationId then
92
+ local ttl = deduplicationOpts['ttl']
93
+ if deduplicationOpts['replace'] and ttl and ttl > 0 then
94
+ local currentDebounceJobId = rcall('GET', deduplicationKey)
95
+ if currentDebounceJobId then
96
+ if rcall("ZREM", delayedKey, currentDebounceJobId) > 0 then
97
+ removeJobKeys(prefix .. currentDebounceJobId)
98
+ rcall("XADD", eventsKey, "*", "event", "removed", "jobId", currentDebounceJobId,
99
+ "prev", "delayed")
100
+ if deduplicationOpts['extend'] then
101
+ rcall('SET', deduplicationKey, jobId, 'PX', ttl)
102
+ else
103
+ rcall('SET', deduplicationKey, jobId, 'KEEPTTL')
104
+ end
105
+ rcall("XADD", eventsKey, "MAXLEN", "~", maxEvents, "*", "event", "deduplicated", "jobId",
106
+ jobId, "deduplicationId", deduplicationId, "deduplicatedJobId", currentDebounceJobId)
107
+ return
108
+ else
109
+ return currentDebounceJobId
110
+ end
111
+ else
112
+ rcall('SET', deduplicationKey, jobId, 'PX', ttl)
113
+ return
114
+ end
115
+ else
116
+ local ttl = deduplicationOpts['ttl']
117
+ local deduplicationKeyExists
118
+ if ttl then
119
+ if deduplicationOpts['extend'] then
120
+ local currentDebounceJobId = rcall('GET', deduplicationKey)
121
+ if currentDebounceJobId then
122
+ rcall('SET', deduplicationKey, currentDebounceJobId, 'PX', ttl)
123
+ rcall("XADD", eventsKey, "MAXLEN", "~", maxEvents, "*", "event", "debounced",
124
+ "jobId", currentDebounceJobId, "debounceId", deduplicationId)
125
+ rcall("XADD", eventsKey, "MAXLEN", "~", maxEvents, "*", "event", "deduplicated", "jobId",
126
+ currentDebounceJobId, "deduplicationId", deduplicationId, "deduplicatedJobId", jobId)
127
+ return currentDebounceJobId
128
+ else
129
+ rcall('SET', deduplicationKey, jobId, 'PX', ttl)
130
+ return
131
+ end
132
+ else
133
+ deduplicationKeyExists = not rcall('SET', deduplicationKey, jobId, 'PX', ttl, 'NX')
134
+ end
135
+ else
136
+ deduplicationKeyExists = not rcall('SET', deduplicationKey, jobId, 'NX')
137
+ end
138
+ if deduplicationKeyExists then
139
+ local currentDebounceJobId = rcall('GET', deduplicationKey)
140
+ rcall("XADD", eventsKey, "MAXLEN", "~", maxEvents, "*", "event", "debounced", "jobId",
141
+ currentDebounceJobId, "debounceId", deduplicationId)
142
+ rcall("XADD", eventsKey, "MAXLEN", "~", maxEvents, "*", "event", "deduplicated", "jobId",
143
+ currentDebounceJobId, "deduplicationId", deduplicationId, "deduplicatedJobId", jobId)
144
+ return currentDebounceJobId
145
+ end
146
+ end
147
+ end
98
148
  end
99
149
  --[[
100
150
  Function to store a job
@@ -340,8 +390,8 @@ else
340
390
  maxEvents, timestamp)
341
391
  end
342
392
  end
343
- local deduplicationJobId = deduplicateJob(opts['de'], jobId,
344
- deduplicationKey, eventsKey, maxEvents)
393
+ local deduplicationJobId = deduplicateJob(opts['de'], jobId, KEYS[5],
394
+ deduplicationKey, eventsKey, maxEvents, args[1])
345
395
  if deduplicationJobId then
346
396
  return deduplicationJobId
347
397
  end
@@ -364,6 +414,6 @@ return jobId .. "" -- convert to string
364
414
  export const addPrioritizedJob = {
365
415
  name: 'addPrioritizedJob',
366
416
  content,
367
- keys: 8,
417
+ keys: 9,
368
418
  };
369
- //# sourceMappingURL=addPrioritizedJob-8.js.map
419
+ //# sourceMappingURL=addPrioritizedJob-9.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"addPrioritizedJob-8.js","sourceRoot":"","sources":["../../../src/scripts/addPrioritizedJob-8.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0Wf,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-9.js","sourceRoot":"","sources":["../../../src/scripts/addPrioritizedJob-9.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4Zf,CAAC;AACF,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,IAAI,EAAE,mBAAmB;IACzB,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
@@ -18,9 +18,10 @@ const content = `--[[
18
18
  KEYS[3] 'meta'
19
19
  KEYS[4] 'id'
20
20
  KEYS[5] 'completed'
21
- KEYS[6] 'active'
22
- KEYS[7] events stream key
23
- KEYS[8] marker key
21
+ KEYS[6] 'delayed'
22
+ KEYS[7] 'active'
23
+ KEYS[8] events stream key
24
+ KEYS[9] marker key
24
25
  ARGV[1] msgpacked arguments array
25
26
  [1] key prefix,
26
27
  [2] custom id (will not generate one automatically)
@@ -38,7 +39,7 @@ const content = `--[[
38
39
  jobId - OK
39
40
  -5 - Missing parent key
40
41
  ]]
41
- local eventsKey = KEYS[7]
42
+ local eventsKey = KEYS[8]
42
43
  local jobId
43
44
  local jobIdKey
44
45
  local rcall = redis.call
@@ -69,26 +70,75 @@ local function addJobInTargetList(targetKey, markerKey, pushCmd, isPausedOrMaxed
69
70
  end
70
71
  --[[
71
72
  Function to debounce a job.
72
- ]]
73
- local function deduplicateJob(deduplicationOpts, jobId, deduplicationKey, eventsKey, maxEvents)
74
- local deduplicationId = deduplicationOpts and deduplicationOpts['id']
75
- if deduplicationId then
76
- local ttl = deduplicationOpts['ttl']
77
- local deduplicationKeyExists
78
- if ttl then
79
- deduplicationKeyExists = not rcall('SET', deduplicationKey, jobId, 'PX', ttl, 'NX')
80
- else
81
- deduplicationKeyExists = not rcall('SET', deduplicationKey, jobId, 'NX')
82
- end
83
- if deduplicationKeyExists then
84
- local currentDebounceJobId = rcall('GET', deduplicationKey)
85
- rcall("XADD", eventsKey, "MAXLEN", "~", maxEvents, "*", "event", "debounced", "jobId", currentDebounceJobId,
86
- "debounceId", deduplicationId)
87
- rcall("XADD", eventsKey, "MAXLEN", "~", maxEvents, "*", "event", "deduplicated", "jobId",
88
- currentDebounceJobId, "deduplicationId", deduplicationId, "deduplicatedJobId", jobId)
89
- return currentDebounceJobId
90
- end
91
- end
73
+ ]]
74
+ -- Includes
75
+ --[[
76
+ Function to remove job keys.
77
+ ]]
78
+ local function removeJobKeys(jobKey)
79
+ return rcall("DEL", jobKey, jobKey .. ':logs', jobKey .. ':dependencies',
80
+ jobKey .. ':processed', jobKey .. ':failed', jobKey .. ':unsuccessful')
81
+ end
82
+ local function deduplicateJob(deduplicationOpts, jobId, delayedKey, deduplicationKey, eventsKey, maxEvents,
83
+ prefix)
84
+ local deduplicationId = deduplicationOpts and deduplicationOpts['id']
85
+ if deduplicationId then
86
+ local ttl = deduplicationOpts['ttl']
87
+ if deduplicationOpts['replace'] and ttl and ttl > 0 then
88
+ local currentDebounceJobId = rcall('GET', deduplicationKey)
89
+ if currentDebounceJobId then
90
+ if rcall("ZREM", delayedKey, currentDebounceJobId) > 0 then
91
+ removeJobKeys(prefix .. currentDebounceJobId)
92
+ rcall("XADD", eventsKey, "*", "event", "removed", "jobId", currentDebounceJobId,
93
+ "prev", "delayed")
94
+ if deduplicationOpts['extend'] then
95
+ rcall('SET', deduplicationKey, jobId, 'PX', ttl)
96
+ else
97
+ rcall('SET', deduplicationKey, jobId, 'KEEPTTL')
98
+ end
99
+ rcall("XADD", eventsKey, "MAXLEN", "~", maxEvents, "*", "event", "deduplicated", "jobId",
100
+ jobId, "deduplicationId", deduplicationId, "deduplicatedJobId", currentDebounceJobId)
101
+ return
102
+ else
103
+ return currentDebounceJobId
104
+ end
105
+ else
106
+ rcall('SET', deduplicationKey, jobId, 'PX', ttl)
107
+ return
108
+ end
109
+ else
110
+ local ttl = deduplicationOpts['ttl']
111
+ local deduplicationKeyExists
112
+ if ttl then
113
+ if deduplicationOpts['extend'] then
114
+ local currentDebounceJobId = rcall('GET', deduplicationKey)
115
+ if currentDebounceJobId then
116
+ rcall('SET', deduplicationKey, currentDebounceJobId, 'PX', ttl)
117
+ rcall("XADD", eventsKey, "MAXLEN", "~", maxEvents, "*", "event", "debounced",
118
+ "jobId", currentDebounceJobId, "debounceId", deduplicationId)
119
+ rcall("XADD", eventsKey, "MAXLEN", "~", maxEvents, "*", "event", "deduplicated", "jobId",
120
+ currentDebounceJobId, "deduplicationId", deduplicationId, "deduplicatedJobId", jobId)
121
+ return currentDebounceJobId
122
+ else
123
+ rcall('SET', deduplicationKey, jobId, 'PX', ttl)
124
+ return
125
+ end
126
+ else
127
+ deduplicationKeyExists = not rcall('SET', deduplicationKey, jobId, 'PX', ttl, 'NX')
128
+ end
129
+ else
130
+ deduplicationKeyExists = not rcall('SET', deduplicationKey, jobId, 'NX')
131
+ end
132
+ if deduplicationKeyExists then
133
+ local currentDebounceJobId = rcall('GET', deduplicationKey)
134
+ rcall("XADD", eventsKey, "MAXLEN", "~", maxEvents, "*", "event", "debounced", "jobId",
135
+ currentDebounceJobId, "debounceId", deduplicationId)
136
+ rcall("XADD", eventsKey, "MAXLEN", "~", maxEvents, "*", "event", "deduplicated", "jobId",
137
+ currentDebounceJobId, "deduplicationId", deduplicationId, "deduplicatedJobId", jobId)
138
+ return currentDebounceJobId
139
+ end
140
+ end
141
+ end
92
142
  end
93
143
  --[[
94
144
  Function to get max events value or set by default 10000.
@@ -344,18 +394,18 @@ else
344
394
  maxEvents, timestamp)
345
395
  end
346
396
  end
347
- local deduplicationJobId = deduplicateJob(opts['de'], jobId,
348
- deduplicationKey, eventsKey, maxEvents)
397
+ local deduplicationJobId = deduplicateJob(opts['de'], jobId, KEYS[6],
398
+ deduplicationKey, eventsKey, maxEvents, args[1])
349
399
  if deduplicationJobId then
350
400
  return deduplicationJobId
351
401
  end
352
402
  -- Store the job.
353
403
  storeJob(eventsKey, jobIdKey, jobId, args[3], ARGV[2], opts, timestamp,
354
404
  parentKey, parentData, repeatJobKey)
355
- local target, isPausedOrMaxed = getTargetQueueList(metaKey, KEYS[6], KEYS[1], KEYS[2])
405
+ local target, isPausedOrMaxed = getTargetQueueList(metaKey, KEYS[7], KEYS[1], KEYS[2])
356
406
  -- LIFO or FIFO
357
407
  local pushCmd = opts['lifo'] and 'RPUSH' or 'LPUSH'
358
- addJobInTargetList(target, KEYS[8], pushCmd, isPausedOrMaxed, jobId)
408
+ addJobInTargetList(target, KEYS[9], pushCmd, isPausedOrMaxed, jobId)
359
409
  -- Emit waiting event
360
410
  rcall("XADD", eventsKey, "MAXLEN", "~", maxEvents, "*", "event", "waiting",
361
411
  "jobId", jobId)
@@ -368,6 +418,6 @@ return jobId .. "" -- convert to string
368
418
  export const addStandardJob = {
369
419
  name: 'addStandardJob',
370
420
  content,
371
- keys: 8,
421
+ keys: 9,
372
422
  };
373
- //# sourceMappingURL=addStandardJob-8.js.map
423
+ //# sourceMappingURL=addStandardJob-9.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"addStandardJob-8.js","sourceRoot":"","sources":["../../../src/scripts/addStandardJob-8.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8Wf,CAAC;AACF,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,IAAI,EAAE,gBAAgB;IACtB,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
1
+ {"version":3,"file":"addStandardJob-9.js","sourceRoot":"","sources":["../../../src/scripts/addStandardJob-9.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgaf,CAAC;AACF,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,IAAI,EAAE,gBAAgB;IACtB,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
@@ -1,10 +1,10 @@
1
1
  export * from './addDelayedJob-6';
2
2
  export * from './addJobScheduler-11';
3
3
  export * from './addLog-2';
4
- export * from './addParentJob-4';
5
- export * from './addPrioritizedJob-8';
4
+ export * from './addParentJob-5';
5
+ export * from './addPrioritizedJob-9';
6
6
  export * from './addRepeatableJob-2';
7
- export * from './addStandardJob-8';
7
+ export * from './addStandardJob-9';
8
8
  export * from './changeDelay-4';
9
9
  export * from './changePriority-7';
10
10
  export * from './cleanJobsInSet-3';
@@ -1,10 +1,10 @@
1
1
  export * from './addDelayedJob-6';
2
2
  export * from './addJobScheduler-11';
3
3
  export * from './addLog-2';
4
- export * from './addParentJob-4';
5
- export * from './addPrioritizedJob-8';
4
+ export * from './addParentJob-5';
5
+ export * from './addPrioritizedJob-9';
6
6
  export * from './addRepeatableJob-2';
7
- export * from './addStandardJob-8';
7
+ export * from './addStandardJob-9';
8
8
  export * from './changeDelay-4';
9
9
  export * from './changePriority-7';
10
10
  export * from './cleanJobsInSet-3';
@@ -138,6 +138,8 @@ local function prepareJobForProcessing(keyPrefix, rateLimiterKey, eventStreamKey
138
138
  rcall("HMSET", jobKey, "processedOn", processedOn, unpack(optionalValues))
139
139
  rcall("HINCRBY", jobKey, "ats", 1)
140
140
  addBaseMarkerIfNeeded(markerKey, false)
141
+ -- rate limit delay must be 0 in this case to prevent adding more delay
142
+ -- when job that is moved to active needs to be processed
141
143
  return {rcall("HGETALL", jobKey), jobId, 0, 0} -- get job data
142
144
  end
143
145
  --[[
@@ -1 +1 @@
1
- {"version":3,"file":"moveToActive-11.js","sourceRoot":"","sources":["../../../src/scripts/moveToActive-11.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuOf,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyOf,CAAC;AACF,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,IAAI,EAAE,cAAc;IACpB,OAAO;IACP,IAAI,EAAE,EAAE;CACT,CAAC"}
@@ -54,7 +54,7 @@ local rcall = redis.call
54
54
  --[[
55
55
  Functions to collect metrics based on a current and previous count of jobs.
56
56
  Granualarity is fixed at 1 minute.
57
- ]]
57
+ ]]
58
58
  --[[
59
59
  Function to loop in batches.
60
60
  Just a bit of warning, some commands as ZREM
@@ -564,6 +564,8 @@ local function prepareJobForProcessing(keyPrefix, rateLimiterKey, eventStreamKey
564
564
  rcall("HMSET", jobKey, "processedOn", processedOn, unpack(optionalValues))
565
565
  rcall("HINCRBY", jobKey, "ats", 1)
566
566
  addBaseMarkerIfNeeded(markerKey, false)
567
+ -- rate limit delay must be 0 in this case to prevent adding more delay
568
+ -- when job that is moved to active needs to be processed
567
569
  return {rcall("HGETALL", jobKey), jobId, 0, 0} -- get job data
568
570
  end
569
571
  --[[