bullmq 5.34.5 → 5.34.7

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 (45) hide show
  1. package/dist/cjs/classes/job-scheduler.js +64 -25
  2. package/dist/cjs/classes/job-scheduler.js.map +1 -1
  3. package/dist/cjs/classes/job.js +1 -0
  4. package/dist/cjs/classes/job.js.map +1 -1
  5. package/dist/cjs/classes/scripts.js +12 -2
  6. package/dist/cjs/classes/scripts.js.map +1 -1
  7. package/dist/cjs/commands/addDelayedJob-6.lua +4 -18
  8. package/dist/cjs/commands/{addJobScheduler-2.lua → addJobScheduler-6.lua} +44 -15
  9. package/dist/cjs/commands/includes/addDelayedJob.lua +25 -0
  10. package/dist/cjs/commands/removeJobScheduler-3.lua +1 -1
  11. package/dist/cjs/scripts/addDelayedJob-6.js +71 -64
  12. package/dist/cjs/scripts/addDelayedJob-6.js.map +1 -1
  13. package/dist/cjs/scripts/{addJobScheduler-2.js → addJobScheduler-6.js} +141 -16
  14. package/dist/cjs/scripts/addJobScheduler-6.js.map +1 -0
  15. package/dist/cjs/scripts/index.js +1 -1
  16. package/dist/cjs/scripts/removeJobScheduler-3.js +1 -1
  17. package/dist/cjs/tsconfig-cjs.tsbuildinfo +1 -1
  18. package/dist/cjs/version.js +1 -1
  19. package/dist/esm/classes/job-scheduler.d.ts +1 -0
  20. package/dist/esm/classes/job-scheduler.js +64 -25
  21. package/dist/esm/classes/job-scheduler.js.map +1 -1
  22. package/dist/esm/classes/job.d.ts +4 -0
  23. package/dist/esm/classes/job.js +1 -0
  24. package/dist/esm/classes/job.js.map +1 -1
  25. package/dist/esm/classes/scripts.d.ts +2 -2
  26. package/dist/esm/classes/scripts.js +12 -2
  27. package/dist/esm/classes/scripts.js.map +1 -1
  28. package/dist/esm/commands/addDelayedJob-6.lua +4 -18
  29. package/dist/esm/commands/{addJobScheduler-2.lua → addJobScheduler-6.lua} +44 -15
  30. package/dist/esm/commands/includes/addDelayedJob.lua +25 -0
  31. package/dist/esm/commands/removeJobScheduler-3.lua +1 -1
  32. package/dist/esm/scripts/addDelayedJob-6.js +71 -64
  33. package/dist/esm/scripts/addDelayedJob-6.js.map +1 -1
  34. package/dist/esm/scripts/{addJobScheduler-2.js → addJobScheduler-6.js} +141 -16
  35. package/dist/esm/scripts/addJobScheduler-6.js.map +1 -0
  36. package/dist/esm/scripts/index.d.ts +1 -1
  37. package/dist/esm/scripts/index.js +1 -1
  38. package/dist/esm/scripts/removeJobScheduler-3.js +1 -1
  39. package/dist/esm/tsconfig.tsbuildinfo +1 -1
  40. package/dist/esm/version.d.ts +1 -1
  41. package/dist/esm/version.js +1 -1
  42. package/package.json +1 -1
  43. package/dist/cjs/scripts/addJobScheduler-2.js.map +0 -1
  44. package/dist/esm/scripts/addJobScheduler-2.js.map +0 -1
  45. /package/dist/esm/scripts/{addJobScheduler-2.d.ts → addJobScheduler-6.d.ts} +0 -0
@@ -45,6 +45,10 @@ local repeatJobKey = args[9]
45
45
  local deduplicationKey = args[10]
46
46
  local parentData
47
47
  -- Includes
48
+ --[[
49
+ Add marker if needed when a job is available.
50
+ ]]
51
+ -- Includes
48
52
  --[[
49
53
  Add delay marker if needed.
50
54
  ]]
@@ -69,29 +73,6 @@ local function addDelayMarkerIfNeeded(markerKey, delayedKey)
69
73
  rcall("ZADD", markerKey, nextTimestamp, "1")
70
74
  end
71
75
  end
72
- --[[
73
- Function to debounce a job.
74
- ]]
75
- local function deduplicateJob(prefixKey, deduplicationOpts, jobId, deduplicationKey, eventsKey, maxEvents)
76
- local deduplicationId = deduplicationOpts and deduplicationOpts['id']
77
- if deduplicationId then
78
- local ttl = deduplicationOpts['ttl']
79
- local deduplicationKeyExists
80
- if ttl then
81
- deduplicationKeyExists = not rcall('SET', deduplicationKey, jobId, 'PX', ttl, 'NX')
82
- else
83
- deduplicationKeyExists = not rcall('SET', deduplicationKey, jobId, 'NX')
84
- end
85
- if deduplicationKeyExists then
86
- local currentDebounceJobId = rcall('GET', deduplicationKey)
87
- rcall("XADD", eventsKey, "MAXLEN", "~", maxEvents, "*", "event",
88
- "debounced", "jobId", currentDebounceJobId, "debounceId", deduplicationId)
89
- rcall("XADD", eventsKey, "MAXLEN", "~", maxEvents, "*", "event",
90
- "deduplicated", "jobId", currentDebounceJobId, "deduplicationId", deduplicationId)
91
- return currentDebounceJobId
92
- end
93
- end
94
- end
95
76
  --[[
96
77
  Bake in the job id first 12 bits into the timestamp
97
78
  to guarantee correct execution order of delayed jobs
@@ -116,6 +97,71 @@ local function getDelayedScore(delayedKey, timestamp, delay)
116
97
  end
117
98
  return minScore, delayedTimestamp
118
99
  end
100
+ --[[
101
+ Function to store a job
102
+ ]]
103
+ local function storeJob(eventsKey, jobIdKey, jobId, name, data, opts, timestamp,
104
+ parentKey, parentData, repeatJobKey)
105
+ local jsonOpts = cjson.encode(opts)
106
+ local delay = opts['delay'] or 0
107
+ local priority = opts['priority'] or 0
108
+ local debounceId = opts['de'] and opts['de']['id']
109
+ local optionalValues = {}
110
+ if parentKey ~= nil then
111
+ table.insert(optionalValues, "parentKey")
112
+ table.insert(optionalValues, parentKey)
113
+ table.insert(optionalValues, "parent")
114
+ table.insert(optionalValues, parentData)
115
+ end
116
+ if repeatJobKey ~= nil then
117
+ table.insert(optionalValues, "rjk")
118
+ table.insert(optionalValues, repeatJobKey)
119
+ end
120
+ if debounceId then
121
+ table.insert(optionalValues, "deid")
122
+ table.insert(optionalValues, debounceId)
123
+ end
124
+ rcall("HMSET", jobIdKey, "name", name, "data", data, "opts", jsonOpts,
125
+ "timestamp", timestamp, "delay", delay, "priority", priority,
126
+ unpack(optionalValues))
127
+ rcall("XADD", eventsKey, "*", "event", "added", "jobId", jobId, "name", name)
128
+ return delay, priority
129
+ end
130
+ local function addDelayedJob(jobIdKey, jobId, delayedKey, eventsKey, name, data, opts, timestamp, repeatJobKey,
131
+ maxEvents, markerKey, parentKey, parentData)
132
+ -- Store the job.
133
+ local delay, priority = storeJob(eventsKey, jobIdKey, jobId, name, data,
134
+ opts, timestamp, parentKey, parentData, repeatJobKey)
135
+ local score, delayedTimestamp = getDelayedScore(delayedKey, timestamp, tonumber(delay))
136
+ rcall("ZADD", delayedKey, score, jobId)
137
+ rcall("XADD", eventsKey, "MAXLEN", "~", maxEvents, "*", "event", "delayed",
138
+ "jobId", jobId, "delay", delayedTimestamp)
139
+ -- mark that a delayed job is available
140
+ addDelayMarkerIfNeeded(markerKey, delayedKey)
141
+ end
142
+ --[[
143
+ Function to debounce a job.
144
+ ]]
145
+ local function deduplicateJob(prefixKey, deduplicationOpts, jobId, deduplicationKey, eventsKey, maxEvents)
146
+ local deduplicationId = deduplicationOpts and deduplicationOpts['id']
147
+ if deduplicationId then
148
+ local ttl = deduplicationOpts['ttl']
149
+ local deduplicationKeyExists
150
+ if ttl then
151
+ deduplicationKeyExists = not rcall('SET', deduplicationKey, jobId, 'PX', ttl, 'NX')
152
+ else
153
+ deduplicationKeyExists = not rcall('SET', deduplicationKey, jobId, 'NX')
154
+ end
155
+ if deduplicationKeyExists then
156
+ local currentDebounceJobId = rcall('GET', deduplicationKey)
157
+ rcall("XADD", eventsKey, "MAXLEN", "~", maxEvents, "*", "event",
158
+ "debounced", "jobId", currentDebounceJobId, "debounceId", deduplicationId)
159
+ rcall("XADD", eventsKey, "MAXLEN", "~", maxEvents, "*", "event",
160
+ "deduplicated", "jobId", currentDebounceJobId, "deduplicationId", deduplicationId)
161
+ return currentDebounceJobId
162
+ end
163
+ end
164
+ end
119
165
  --[[
120
166
  Function to get max events value or set by default 10000.
121
167
  ]]
@@ -289,36 +335,6 @@ local function handleDuplicatedJob(jobKey, jobId, currentParentKey, currentParen
289
335
  "duplicated", "jobId", jobId)
290
336
  return jobId .. "" -- convert to string
291
337
  end
292
- --[[
293
- Function to store a job
294
- ]]
295
- local function storeJob(eventsKey, jobIdKey, jobId, name, data, opts, timestamp,
296
- parentKey, parentData, repeatJobKey)
297
- local jsonOpts = cjson.encode(opts)
298
- local delay = opts['delay'] or 0
299
- local priority = opts['priority'] or 0
300
- local debounceId = opts['de'] and opts['de']['id']
301
- local optionalValues = {}
302
- if parentKey ~= nil then
303
- table.insert(optionalValues, "parentKey")
304
- table.insert(optionalValues, parentKey)
305
- table.insert(optionalValues, "parent")
306
- table.insert(optionalValues, parentData)
307
- end
308
- if repeatJobKey ~= nil then
309
- table.insert(optionalValues, "rjk")
310
- table.insert(optionalValues, repeatJobKey)
311
- end
312
- if debounceId then
313
- table.insert(optionalValues, "deid")
314
- table.insert(optionalValues, debounceId)
315
- end
316
- rcall("HMSET", jobIdKey, "name", name, "data", data, "opts", jsonOpts,
317
- "timestamp", timestamp, "delay", delay, "priority", priority,
318
- unpack(optionalValues))
319
- rcall("XADD", eventsKey, "*", "event", "added", "jobId", jobId, "name", name)
320
- return delay, priority
321
- end
322
338
  if parentKey ~= nil then
323
339
  if rcall("EXISTS", parentKey) ~= 1 then return -5 end
324
340
  parentData = cjson.encode(parent)
@@ -345,17 +361,8 @@ local deduplicationJobId = deduplicateJob(args[1], opts['de'],
345
361
  if deduplicationJobId then
346
362
  return deduplicationJobId
347
363
  end
348
- -- Store the job.
349
- local delay, priority = storeJob(eventsKey, jobIdKey, jobId, args[3], ARGV[2],
350
- opts, timestamp, parentKey, parentData,
351
- repeatJobKey)
352
- local score, delayedTimestamp = getDelayedScore(delayedKey, timestamp, tonumber(delay))
353
- rcall("ZADD", delayedKey, score, jobId)
354
- rcall("XADD", eventsKey, "MAXLEN", "~", maxEvents, "*", "event", "delayed",
355
- "jobId", jobId, "delay", delayedTimestamp)
356
- -- mark that a delayed job is available
357
- local markerKey = KEYS[1]
358
- addDelayMarkerIfNeeded(markerKey, delayedKey)
364
+ addDelayedJob(jobIdKey, jobId, delayedKey, eventsKey, args[3], ARGV[2], opts, timestamp, repeatJobKey,
365
+ maxEvents, KEYS[1], parentKey, parentData)
359
366
  -- Check if this job is a child of another job, if so add it to the parents dependencies
360
367
  if parentDependenciesKey ~= nil then
361
368
  rcall("SADD", parentDependenciesKey, jobIdKey)
@@ -1 +1 @@
1
- {"version":3,"file":"addDelayedJob-6.js","sourceRoot":"","sources":["../../../src/scripts/addDelayedJob-6.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2Wf,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkXf,CAAC;AACF,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,IAAI,EAAE,eAAe;IACrB,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
@@ -1,8 +1,12 @@
1
1
  const content = `--[[
2
2
  Adds a job scheduler, i.e. a job factory that creates jobs based on a given schedule (repeat options).
3
3
  Input:
4
- KEYS[1] 'repeat' key
5
- KEYS[2] 'delayed' key
4
+ KEYS[1] 'marker',
5
+ KEYS[2] 'meta'
6
+ KEYS[3] 'id'
7
+ KEYS[4] 'delayed'
8
+ KEYS[5] events stream key
9
+ KEYS[6] 'repeat' key
6
10
  ARGV[1] next milliseconds
7
11
  ARGV[2] msgpacked options
8
12
  [1] name
@@ -12,19 +16,128 @@ const content = `--[[
12
16
  [5] every?
13
17
  ARGV[3] jobs scheduler id
14
18
  ARGV[4] Json stringified template data
15
- ARGV[5] mspacked template opts
16
- ARGV[6] prefix key
19
+ ARGV[5] msgpacked template opts
20
+ ARGV[6] msgpacked delayed opts
21
+ ARGV[7] timestamp
22
+ ARGV[8] prefix key
23
+ ARGV[9] producer key
17
24
  Output:
18
- repeatableKey - OK
25
+ next delayed job id - OK
19
26
  ]]
20
27
  local rcall = redis.call
21
- local repeatKey = KEYS[1]
22
- local delayedKey = KEYS[2]
28
+ local repeatKey = KEYS[6]
29
+ local delayedKey = KEYS[4]
30
+ local timestamp = ARGV[7]
23
31
  local nextMillis = ARGV[1]
24
32
  local jobSchedulerId = ARGV[3]
25
33
  local templateOpts = cmsgpack.unpack(ARGV[5])
26
- local prefixKey = ARGV[6]
34
+ local prefixKey = ARGV[8]
27
35
  -- Includes
36
+ --[[
37
+ Add marker if needed when a job is available.
38
+ ]]
39
+ -- Includes
40
+ --[[
41
+ Add delay marker if needed.
42
+ ]]
43
+ -- Includes
44
+ --[[
45
+ Function to return the next delayed job timestamp.
46
+ ]]
47
+ local function getNextDelayedTimestamp(delayedKey)
48
+ local result = rcall("ZRANGE", delayedKey, 0, 0, "WITHSCORES")
49
+ if #result then
50
+ local nextTimestamp = tonumber(result[2])
51
+ if nextTimestamp ~= nil then
52
+ return nextTimestamp / 0x1000
53
+ end
54
+ end
55
+ end
56
+ local function addDelayMarkerIfNeeded(markerKey, delayedKey)
57
+ local nextTimestamp = getNextDelayedTimestamp(delayedKey)
58
+ if nextTimestamp ~= nil then
59
+ -- Replace the score of the marker with the newest known
60
+ -- next timestamp.
61
+ rcall("ZADD", markerKey, nextTimestamp, "1")
62
+ end
63
+ end
64
+ --[[
65
+ Bake in the job id first 12 bits into the timestamp
66
+ to guarantee correct execution order of delayed jobs
67
+ (up to 4096 jobs per given timestamp or 4096 jobs apart per timestamp)
68
+ WARNING: Jobs that are so far apart that they wrap around will cause FIFO to fail
69
+ ]]
70
+ local function getDelayedScore(delayedKey, timestamp, delay)
71
+ local delayedTimestamp = (delay > 0 and (tonumber(timestamp) + delay)) or tonumber(timestamp)
72
+ local minScore = delayedTimestamp * 0x1000
73
+ local maxScore = (delayedTimestamp + 1 ) * 0x1000 - 1
74
+ local result = rcall("ZREVRANGEBYSCORE", delayedKey, maxScore,
75
+ minScore, "WITHSCORES","LIMIT", 0, 1)
76
+ if #result then
77
+ local currentMaxScore = tonumber(result[2])
78
+ if currentMaxScore ~= nil then
79
+ if currentMaxScore >= maxScore then
80
+ return maxScore, delayedTimestamp
81
+ else
82
+ return currentMaxScore + 1, delayedTimestamp
83
+ end
84
+ end
85
+ end
86
+ return minScore, delayedTimestamp
87
+ end
88
+ --[[
89
+ Function to store a job
90
+ ]]
91
+ local function storeJob(eventsKey, jobIdKey, jobId, name, data, opts, timestamp,
92
+ parentKey, parentData, repeatJobKey)
93
+ local jsonOpts = cjson.encode(opts)
94
+ local delay = opts['delay'] or 0
95
+ local priority = opts['priority'] or 0
96
+ local debounceId = opts['de'] and opts['de']['id']
97
+ local optionalValues = {}
98
+ if parentKey ~= nil then
99
+ table.insert(optionalValues, "parentKey")
100
+ table.insert(optionalValues, parentKey)
101
+ table.insert(optionalValues, "parent")
102
+ table.insert(optionalValues, parentData)
103
+ end
104
+ if repeatJobKey ~= nil then
105
+ table.insert(optionalValues, "rjk")
106
+ table.insert(optionalValues, repeatJobKey)
107
+ end
108
+ if debounceId then
109
+ table.insert(optionalValues, "deid")
110
+ table.insert(optionalValues, debounceId)
111
+ end
112
+ rcall("HMSET", jobIdKey, "name", name, "data", data, "opts", jsonOpts,
113
+ "timestamp", timestamp, "delay", delay, "priority", priority,
114
+ unpack(optionalValues))
115
+ rcall("XADD", eventsKey, "*", "event", "added", "jobId", jobId, "name", name)
116
+ return delay, priority
117
+ end
118
+ local function addDelayedJob(jobIdKey, jobId, delayedKey, eventsKey, name, data, opts, timestamp, repeatJobKey,
119
+ maxEvents, markerKey, parentKey, parentData)
120
+ -- Store the job.
121
+ local delay, priority = storeJob(eventsKey, jobIdKey, jobId, name, data,
122
+ opts, timestamp, parentKey, parentData, repeatJobKey)
123
+ local score, delayedTimestamp = getDelayedScore(delayedKey, timestamp, tonumber(delay))
124
+ rcall("ZADD", delayedKey, score, jobId)
125
+ rcall("XADD", eventsKey, "MAXLEN", "~", maxEvents, "*", "event", "delayed",
126
+ "jobId", jobId, "delay", delayedTimestamp)
127
+ -- mark that a delayed job is available
128
+ addDelayMarkerIfNeeded(markerKey, delayedKey)
129
+ end
130
+ --[[
131
+ Function to get max events value or set by default 10000.
132
+ ]]
133
+ local function getOrSetMaxEvents(metaKey)
134
+ local maxEvents = rcall("HGET", metaKey, "opts.maxLenEvents")
135
+ if not maxEvents then
136
+ maxEvents = 10000
137
+ rcall("HSET", metaKey, "opts.maxLenEvents", maxEvents)
138
+ end
139
+ return maxEvents
140
+ end
28
141
  --[[
29
142
  Function to remove job.
30
143
  ]]
@@ -178,9 +291,8 @@ local function removeJob(jobId, hard, baseKey, shouldRemoveDeduplicationKey)
178
291
  end
179
292
  removeJobKeys(jobKey)
180
293
  end
181
- local function storeRepeatableJob(schedulerId, repeatKey, nextMillis, rawOpts, templateData, templateOpts)
294
+ local function storeRepeatableJob(schedulerId, schedulerKey, repeatKey, nextMillis, opts, templateData, templateOpts)
182
295
  rcall("ZADD", repeatKey, nextMillis, schedulerId)
183
- local opts = cmsgpack.unpack(rawOpts)
184
296
  local optionalValues = {}
185
297
  if opts['tz'] then
186
298
  table.insert(optionalValues, "tz")
@@ -207,16 +319,17 @@ local function storeRepeatableJob(schedulerId, repeatKey, nextMillis, rawOpts, t
207
319
  table.insert(optionalValues, "data")
208
320
  table.insert(optionalValues, templateData)
209
321
  end
210
- rcall("HMSET", repeatKey .. ":" .. schedulerId, "name", opts['name'],
322
+ rcall("HMSET", schedulerKey, "name", opts['name'],
211
323
  unpack(optionalValues))
212
324
  end
325
+ local schedulerKey = repeatKey .. ":" .. jobSchedulerId
326
+ local nextDelayedJobId = "repeat:" .. jobSchedulerId .. ":" .. nextMillis
327
+ local nextDelayedJobKey = schedulerKey .. ":" .. nextMillis
213
328
  -- If we are overriding a repeatable job we must delete the delayed job for
214
329
  -- the next iteration.
215
330
  local prevMillis = rcall("ZSCORE", repeatKey, jobSchedulerId)
216
331
  if prevMillis ~= false then
217
332
  local delayedJobId = "repeat:" .. jobSchedulerId .. ":" .. prevMillis
218
- local nextDelayedJobId = "repeat:" .. jobSchedulerId .. ":" .. nextMillis
219
- local nextDelayedJobKey = repeatKey .. ":" .. jobSchedulerId .. ":" .. nextMillis
220
333
  if rcall("ZSCORE", delayedKey, delayedJobId) ~= false
221
334
  and (rcall("EXISTS", nextDelayedJobKey) ~= 1
222
335
  or delayedJobId == nextDelayedJobId) then
@@ -224,11 +337,23 @@ if prevMillis ~= false then
224
337
  rcall("ZREM", delayedKey, delayedJobId)
225
338
  end
226
339
  end
227
- return storeRepeatableJob(jobSchedulerId, repeatKey, nextMillis, ARGV[2], ARGV[4], templateOpts)
340
+ local schedulerOpts = cmsgpack.unpack(ARGV[2])
341
+ storeRepeatableJob(jobSchedulerId, schedulerKey, repeatKey, nextMillis, schedulerOpts, ARGV[4], templateOpts)
342
+ local eventsKey = KEYS[5]
343
+ local metaKey = KEYS[2]
344
+ local maxEvents = getOrSetMaxEvents(metaKey)
345
+ rcall("INCR", KEYS[3])
346
+ local delayedOpts = cmsgpack.unpack(ARGV[6])
347
+ addDelayedJob(nextDelayedJobKey, nextDelayedJobId, delayedKey, eventsKey, schedulerOpts['name'], ARGV[4], delayedOpts,
348
+ timestamp, jobSchedulerId, maxEvents, KEYS[1], nil, nil)
349
+ if ARGV[9] ~= "" then
350
+ rcall("HSET", ARGV[9], "nrjid", nextDelayedJobId)
351
+ end
352
+ return nextDelayedJobId .. "" -- convert to string
228
353
  `;
229
354
  export const addJobScheduler = {
230
355
  name: 'addJobScheduler',
231
356
  content,
232
- keys: 2,
357
+ keys: 6,
233
358
  };
234
- //# sourceMappingURL=addJobScheduler-2.js.map
359
+ //# sourceMappingURL=addJobScheduler-6.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"addJobScheduler-6.js","sourceRoot":"","sources":["../../../src/scripts/addJobScheduler-6.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgWf,CAAC;AACF,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,IAAI,EAAE,iBAAiB;IACvB,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
@@ -1,5 +1,5 @@
1
1
  export * from './addDelayedJob-6';
2
- export * from './addJobScheduler-2';
2
+ export * from './addJobScheduler-6';
3
3
  export * from './addLog-2';
4
4
  export * from './addParentJob-4';
5
5
  export * from './addPrioritizedJob-8';
@@ -1,5 +1,5 @@
1
1
  export * from './addDelayedJob-6';
2
- export * from './addJobScheduler-2';
2
+ export * from './addJobScheduler-6';
3
3
  export * from './addLog-2';
4
4
  export * from './addParentJob-4';
5
5
  export * from './addPrioritizedJob-8';
@@ -1,5 +1,5 @@
1
1
  const content = `--[[
2
- Removes a repeatable job
2
+ Removes a job scheduler and its next scheduled job.
3
3
  Input:
4
4
  KEYS[1] job schedulers key
5
5
  KEYS[2] delayed jobs key