bullmq 5.30.0 → 5.30.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.
@@ -182,40 +182,10 @@ local function removeDeduplicationKeyIfNeeded(prefixKey, deduplicationId)
182
182
  end
183
183
  end
184
184
  end
185
- local function moveParentFromWaitingChildrenToFailed( parentQueueKey, parentKey, parentId, jobIdKey, timestamp)
186
- if rcall("ZREM", parentQueueKey .. ":waiting-children", parentId) == 1 then
187
- rcall("ZADD", parentQueueKey .. ":failed", timestamp, parentId)
188
- local failedReason = "child " .. jobIdKey .. " failed"
189
- rcall("HMSET", parentKey, "failedReason", failedReason, "finishedOn", timestamp)
190
- rcall("XADD", parentQueueKey .. ":events", "*", "event", "failed", "jobId", parentId, "failedReason",
191
- failedReason, "prev", "waiting-children")
192
- local jobAttributes = rcall("HMGET", parentKey, "parent", "deid")
193
- removeDeduplicationKeyIfNeeded(parentQueueKey .. ":", jobAttributes[2])
194
- if jobAttributes[1] then
195
- local parentData = cjson.decode(jobAttributes[1])
196
- if parentData['fpof'] then
197
- moveParentFromWaitingChildrenToFailed(
198
- parentData['queueKey'],
199
- parentData['queueKey'] .. ':' .. parentData['id'],
200
- parentData['id'],
201
- parentKey,
202
- timestamp
203
- )
204
- elseif parentData['idof'] or parentData['rdof'] then
205
- local grandParentKey = parentData['queueKey'] .. ':' .. parentData['id']
206
- local grandParentDependenciesSet = grandParentKey .. ":dependencies"
207
- if rcall("SREM", grandParentDependenciesSet, parentKey) == 1 then
208
- moveParentToWaitIfNeeded(parentData['queueKey'], grandParentDependenciesSet,
209
- grandParentKey, parentData['id'], timestamp)
210
- if parentData['idof'] then
211
- local grandParentFailedSet = grandParentKey .. ":failed"
212
- rcall("HSET", grandParentFailedSet, parentKey, failedReason)
213
- end
214
- end
215
- end
216
- end
217
- end
218
- end
185
+ --[[
186
+ Functions to remove jobs when removeOnFail option is provided.
187
+ ]]
188
+ -- Includes
219
189
  --[[
220
190
  Function to remove job.
221
191
  ]]
@@ -358,6 +328,69 @@ local function removeJobsByMaxCount(maxCount, targetSet, prefix)
358
328
  end
359
329
  rcall("ZREMRANGEBYRANK", targetSet, 0, -(maxCount + 1))
360
330
  end
331
+ local function removeJobsOnFail(queueKeyPrefix, failedKey, jobId, opts, timestamp)
332
+ local removeOnFailType = type(opts["removeOnFail"])
333
+ if removeOnFailType == "number" then
334
+ removeJobsByMaxCount(opts["removeOnFail"],
335
+ failedKey, queueKeyPrefix)
336
+ elseif removeOnFailType == "boolean" then
337
+ if opts["removeOnFail"] then
338
+ removeJob(jobId, false, queueKeyPrefix,
339
+ false --[[remove debounce key]])
340
+ rcall("ZREM", failedKey, jobId)
341
+ end
342
+ elseif removeOnFailType ~= "nil" then
343
+ local maxAge = opts["removeOnFail"]["age"]
344
+ local maxCount = opts["removeOnFail"]["count"]
345
+ if maxAge ~= nil then
346
+ removeJobsByMaxAge(timestamp, maxAge,
347
+ failedKey, queueKeyPrefix)
348
+ end
349
+ if maxCount ~= nil and maxCount > 0 then
350
+ removeJobsByMaxCount(maxCount, failedKey,
351
+ queueKeyPrefix)
352
+ end
353
+ end
354
+ end
355
+ local function moveParentFromWaitingChildrenToFailed( parentQueueKey, parentKey, parentId, jobIdKey, timestamp)
356
+ if rcall("ZREM", parentQueueKey .. ":waiting-children", parentId) == 1 then
357
+ local parentQueuePrefix = parentQueueKey .. ":"
358
+ local parentFailedKey = parentQueueKey .. ":failed"
359
+ rcall("ZADD", parentFailedKey, timestamp, parentId)
360
+ local failedReason = "child " .. jobIdKey .. " failed"
361
+ rcall("HMSET", parentKey, "failedReason", failedReason, "finishedOn", timestamp)
362
+ rcall("XADD", parentQueueKey .. ":events", "*", "event", "failed", "jobId", parentId, "failedReason",
363
+ failedReason, "prev", "waiting-children")
364
+ local jobAttributes = rcall("HMGET", parentKey, "parent", "deid", "opts")
365
+ removeDeduplicationKeyIfNeeded(parentQueueKey .. ":", jobAttributes[2])
366
+ if jobAttributes[1] then
367
+ local parentData = cjson.decode(jobAttributes[1])
368
+ if parentData['fpof'] then
369
+ moveParentFromWaitingChildrenToFailed(
370
+ parentData['queueKey'],
371
+ parentData['queueKey'] .. ':' .. parentData['id'],
372
+ parentData['id'],
373
+ parentKey,
374
+ timestamp
375
+ )
376
+ elseif parentData['idof'] or parentData['rdof'] then
377
+ local grandParentKey = parentData['queueKey'] .. ':' .. parentData['id']
378
+ local grandParentDependenciesSet = grandParentKey .. ":dependencies"
379
+ if rcall("SREM", grandParentDependenciesSet, parentKey) == 1 then
380
+ moveParentToWaitIfNeeded(parentData['queueKey'], grandParentDependenciesSet,
381
+ grandParentKey, parentData['id'], timestamp)
382
+ if parentData['idof'] then
383
+ local grandParentFailedSet = grandParentKey .. ":failed"
384
+ rcall("HSET", grandParentFailedSet, parentKey, failedReason)
385
+ end
386
+ end
387
+ end
388
+ end
389
+ local parentRawOpts = jobAttributes[3]
390
+ local parentOpts = cjson.decode(parentRawOpts)
391
+ removeJobsOnFail(parentQueuePrefix, parentFailedKey, parentId, parentOpts, timestamp)
392
+ end
393
+ end
361
394
  --[[
362
395
  Function to trim events, default 10000.
363
396
  ]]
@@ -425,7 +458,6 @@ if (#stalling > 0) then
425
458
  local rawOpts = jobAttributes[1]
426
459
  local rawParentData = jobAttributes[2]
427
460
  local opts = cjson.decode(rawOpts)
428
- local removeOnFailType = type(opts["removeOnFail"])
429
461
  rcall("ZADD", failedKey, timestamp, jobId)
430
462
  removeDeduplicationKeyIfNeeded(queueKeyPrefix, jobAttributes[3])
431
463
  local failedReason =
@@ -459,27 +491,7 @@ if (#stalling > 0) then
459
491
  end
460
492
  end
461
493
  end
462
- if removeOnFailType == "number" then
463
- removeJobsByMaxCount(opts["removeOnFail"],
464
- failedKey, queueKeyPrefix)
465
- elseif removeOnFailType == "boolean" then
466
- if opts["removeOnFail"] then
467
- removeJob(jobId, false, queueKeyPrefix,
468
- false --[[remove debounce key]])
469
- rcall("ZREM", failedKey, jobId)
470
- end
471
- elseif removeOnFailType ~= "nil" then
472
- local maxAge = opts["removeOnFail"]["age"]
473
- local maxCount = opts["removeOnFail"]["count"]
474
- if maxAge ~= nil then
475
- removeJobsByMaxAge(timestamp, maxAge,
476
- failedKey, queueKeyPrefix)
477
- end
478
- if maxCount ~= nil and maxCount > 0 then
479
- removeJobsByMaxCount(maxCount, failedKey,
480
- queueKeyPrefix)
481
- end
482
- end
494
+ removeJobsOnFail(queueKeyPrefix, failedKey, jobId, opts, timestamp)
483
495
  table.insert(failed, jobId)
484
496
  else
485
497
  local target, isPausedOrMaxed =
@@ -1 +1 @@
1
- {"version":3,"file":"moveStalledJobsToWait-9.js","sourceRoot":"","sources":["../../../src/scripts/moveStalledJobsToWait-9.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBA2fS,CAAC;AAC1B,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,IAAI,EAAE,uBAAuB;IAC7B,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
1
+ {"version":3,"file":"moveStalledJobsToWait-9.js","sourceRoot":"","sources":["../../../src/scripts/moveStalledJobsToWait-9.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBAugBS,CAAC;AAC1B,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,IAAI,EAAE,uBAAuB;IAC7B,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
@@ -275,117 +275,8 @@ local function removeDeduplicationKeyIfNeeded(prefixKey, deduplicationId)
275
275
  end
276
276
  end
277
277
  end
278
- local function moveParentFromWaitingChildrenToFailed( parentQueueKey, parentKey, parentId, jobIdKey, timestamp)
279
- if rcall("ZREM", parentQueueKey .. ":waiting-children", parentId) == 1 then
280
- rcall("ZADD", parentQueueKey .. ":failed", timestamp, parentId)
281
- local failedReason = "child " .. jobIdKey .. " failed"
282
- rcall("HMSET", parentKey, "failedReason", failedReason, "finishedOn", timestamp)
283
- rcall("XADD", parentQueueKey .. ":events", "*", "event", "failed", "jobId", parentId, "failedReason",
284
- failedReason, "prev", "waiting-children")
285
- local jobAttributes = rcall("HMGET", parentKey, "parent", "deid")
286
- removeDeduplicationKeyIfNeeded(parentQueueKey .. ":", jobAttributes[2])
287
- if jobAttributes[1] then
288
- local parentData = cjson.decode(jobAttributes[1])
289
- if parentData['fpof'] then
290
- moveParentFromWaitingChildrenToFailed(
291
- parentData['queueKey'],
292
- parentData['queueKey'] .. ':' .. parentData['id'],
293
- parentData['id'],
294
- parentKey,
295
- timestamp
296
- )
297
- elseif parentData['idof'] or parentData['rdof'] then
298
- local grandParentKey = parentData['queueKey'] .. ':' .. parentData['id']
299
- local grandParentDependenciesSet = grandParentKey .. ":dependencies"
300
- if rcall("SREM", grandParentDependenciesSet, parentKey) == 1 then
301
- moveParentToWaitIfNeeded(parentData['queueKey'], grandParentDependenciesSet,
302
- grandParentKey, parentData['id'], timestamp)
303
- if parentData['idof'] then
304
- local grandParentFailedSet = grandParentKey .. ":failed"
305
- rcall("HSET", grandParentFailedSet, parentKey, failedReason)
306
- end
307
- end
308
- end
309
- end
310
- end
311
- end
312
- --[[
313
- Function to move job from wait state to active.
314
- Input:
315
- opts - token - lock token
316
- opts - lockDuration
317
- opts - limiter
318
- ]]
319
- -- Includes
320
- local function prepareJobForProcessing(keyPrefix, rateLimiterKey, eventStreamKey,
321
- jobId, processedOn, maxJobs, markerKey, opts)
322
- local jobKey = keyPrefix .. jobId
323
- -- Check if we need to perform rate limiting.
324
- if maxJobs then
325
- local jobCounter = tonumber(rcall("INCR", rateLimiterKey))
326
- if jobCounter == 1 then
327
- local limiterDuration = opts['limiter'] and opts['limiter']['duration']
328
- local integerDuration = math.floor(math.abs(limiterDuration))
329
- rcall("PEXPIRE", rateLimiterKey, integerDuration)
330
- end
331
- end
332
- local lockKey = jobKey .. ':lock'
333
- -- get a lock
334
- if opts['token'] ~= "0" then
335
- rcall("SET", lockKey, opts['token'], "PX", opts['lockDuration'])
336
- end
337
- local optionalValues = {}
338
- if opts['name'] then
339
- -- Set "processedBy" field to the worker name
340
- table.insert(optionalValues, "pb")
341
- table.insert(optionalValues, opts['name'])
342
- end
343
- rcall("XADD", eventStreamKey, "*", "event", "active", "jobId", jobId, "prev", "waiting")
344
- rcall("HMSET", jobKey, "processedOn", processedOn, unpack(optionalValues))
345
- rcall("HINCRBY", jobKey, "ats", 1)
346
- addBaseMarkerIfNeeded(markerKey, false)
347
- return {rcall("HGETALL", jobKey), jobId, 0, 0} -- get job data
348
- end
349
- --[[
350
- Updates the delay set, by moving delayed jobs that should
351
- be processed now to "wait".
352
- Events:
353
- 'waiting'
354
- ]]
355
- -- Includes
356
- -- Try to get as much as 1000 jobs at once
357
- local function promoteDelayedJobs(delayedKey, markerKey, targetKey, prioritizedKey,
358
- eventStreamKey, prefix, timestamp, priorityCounterKey, isPaused)
359
- local jobs = rcall("ZRANGEBYSCORE", delayedKey, 0, (timestamp + 1) * 0x1000 - 1, "LIMIT", 0, 1000)
360
- if (#jobs > 0) then
361
- rcall("ZREM", delayedKey, unpack(jobs))
362
- for _, jobId in ipairs(jobs) do
363
- local jobKey = prefix .. jobId
364
- local priority =
365
- tonumber(rcall("HGET", jobKey, "priority")) or 0
366
- if priority == 0 then
367
- -- LIFO or FIFO
368
- addJobInTargetList(targetKey, markerKey, "LPUSH", isPaused, jobId)
369
- else
370
- addJobWithPriority(markerKey, prioritizedKey, priority,
371
- jobId, priorityCounterKey, isPaused)
372
- end
373
- -- Emit waiting event
374
- rcall("XADD", eventStreamKey, "*", "event", "waiting", "jobId",
375
- jobId, "prev", "delayed")
376
- rcall("HSET", jobKey, "delay", 0)
377
- end
378
- end
379
- end
380
- --[[
381
- Function to remove job keys.
382
- ]]
383
- local function removeJobKeys(jobKey)
384
- return rcall("DEL", jobKey, jobKey .. ':logs',
385
- jobKey .. ':dependencies', jobKey .. ':processed', jobKey .. ':failed')
386
- end
387
278
  --[[
388
- Functions to remove jobs by max age.
279
+ Functions to remove jobs when removeOnFail option is provided.
389
280
  ]]
390
281
  -- Includes
391
282
  --[[
@@ -402,6 +293,13 @@ local function removeDeduplicationKey(prefixKey, jobKey)
402
293
  rcall("DEL", deduplicationKey)
403
294
  end
404
295
  end
296
+ --[[
297
+ Function to remove job keys.
298
+ ]]
299
+ local function removeJobKeys(jobKey)
300
+ return rcall("DEL", jobKey, jobKey .. ':logs',
301
+ jobKey .. ':dependencies', jobKey .. ':processed', jobKey .. ':failed')
302
+ end
405
303
  --[[
406
304
  Check if this job has a parent. If so we will just remove it from
407
305
  the parent child list, but if it is the last child we should move the parent to "wait/paused"
@@ -498,6 +396,10 @@ local function removeJob(jobId, hard, baseKey, shouldRemoveDeduplicationKey)
498
396
  end
499
397
  removeJobKeys(jobKey)
500
398
  end
399
+ --[[
400
+ Functions to remove jobs by max age.
401
+ ]]
402
+ -- Includes
501
403
  local function removeJobsByMaxAge(timestamp, maxAge, targetSet, prefix,
502
404
  shouldRemoveDebounceKey)
503
405
  local start = timestamp - maxAge * 1000
@@ -519,6 +421,137 @@ local function removeJobsByMaxCount(maxCount, targetSet, prefix)
519
421
  end
520
422
  rcall("ZREMRANGEBYRANK", targetSet, 0, -(maxCount + 1))
521
423
  end
424
+ local function removeJobsOnFail(queueKeyPrefix, failedKey, jobId, opts, timestamp)
425
+ local removeOnFailType = type(opts["removeOnFail"])
426
+ if removeOnFailType == "number" then
427
+ removeJobsByMaxCount(opts["removeOnFail"],
428
+ failedKey, queueKeyPrefix)
429
+ elseif removeOnFailType == "boolean" then
430
+ if opts["removeOnFail"] then
431
+ removeJob(jobId, false, queueKeyPrefix,
432
+ false --[[remove debounce key]])
433
+ rcall("ZREM", failedKey, jobId)
434
+ end
435
+ elseif removeOnFailType ~= "nil" then
436
+ local maxAge = opts["removeOnFail"]["age"]
437
+ local maxCount = opts["removeOnFail"]["count"]
438
+ if maxAge ~= nil then
439
+ removeJobsByMaxAge(timestamp, maxAge,
440
+ failedKey, queueKeyPrefix)
441
+ end
442
+ if maxCount ~= nil and maxCount > 0 then
443
+ removeJobsByMaxCount(maxCount, failedKey,
444
+ queueKeyPrefix)
445
+ end
446
+ end
447
+ end
448
+ local function moveParentFromWaitingChildrenToFailed( parentQueueKey, parentKey, parentId, jobIdKey, timestamp)
449
+ if rcall("ZREM", parentQueueKey .. ":waiting-children", parentId) == 1 then
450
+ local parentQueuePrefix = parentQueueKey .. ":"
451
+ local parentFailedKey = parentQueueKey .. ":failed"
452
+ rcall("ZADD", parentFailedKey, timestamp, parentId)
453
+ local failedReason = "child " .. jobIdKey .. " failed"
454
+ rcall("HMSET", parentKey, "failedReason", failedReason, "finishedOn", timestamp)
455
+ rcall("XADD", parentQueueKey .. ":events", "*", "event", "failed", "jobId", parentId, "failedReason",
456
+ failedReason, "prev", "waiting-children")
457
+ local jobAttributes = rcall("HMGET", parentKey, "parent", "deid", "opts")
458
+ removeDeduplicationKeyIfNeeded(parentQueueKey .. ":", jobAttributes[2])
459
+ if jobAttributes[1] then
460
+ local parentData = cjson.decode(jobAttributes[1])
461
+ if parentData['fpof'] then
462
+ moveParentFromWaitingChildrenToFailed(
463
+ parentData['queueKey'],
464
+ parentData['queueKey'] .. ':' .. parentData['id'],
465
+ parentData['id'],
466
+ parentKey,
467
+ timestamp
468
+ )
469
+ elseif parentData['idof'] or parentData['rdof'] then
470
+ local grandParentKey = parentData['queueKey'] .. ':' .. parentData['id']
471
+ local grandParentDependenciesSet = grandParentKey .. ":dependencies"
472
+ if rcall("SREM", grandParentDependenciesSet, parentKey) == 1 then
473
+ moveParentToWaitIfNeeded(parentData['queueKey'], grandParentDependenciesSet,
474
+ grandParentKey, parentData['id'], timestamp)
475
+ if parentData['idof'] then
476
+ local grandParentFailedSet = grandParentKey .. ":failed"
477
+ rcall("HSET", grandParentFailedSet, parentKey, failedReason)
478
+ end
479
+ end
480
+ end
481
+ end
482
+ local parentRawOpts = jobAttributes[3]
483
+ local parentOpts = cjson.decode(parentRawOpts)
484
+ removeJobsOnFail(parentQueuePrefix, parentFailedKey, parentId, parentOpts, timestamp)
485
+ end
486
+ end
487
+ --[[
488
+ Function to move job from wait state to active.
489
+ Input:
490
+ opts - token - lock token
491
+ opts - lockDuration
492
+ opts - limiter
493
+ ]]
494
+ -- Includes
495
+ local function prepareJobForProcessing(keyPrefix, rateLimiterKey, eventStreamKey,
496
+ jobId, processedOn, maxJobs, markerKey, opts)
497
+ local jobKey = keyPrefix .. jobId
498
+ -- Check if we need to perform rate limiting.
499
+ if maxJobs then
500
+ local jobCounter = tonumber(rcall("INCR", rateLimiterKey))
501
+ if jobCounter == 1 then
502
+ local limiterDuration = opts['limiter'] and opts['limiter']['duration']
503
+ local integerDuration = math.floor(math.abs(limiterDuration))
504
+ rcall("PEXPIRE", rateLimiterKey, integerDuration)
505
+ end
506
+ end
507
+ local lockKey = jobKey .. ':lock'
508
+ -- get a lock
509
+ if opts['token'] ~= "0" then
510
+ rcall("SET", lockKey, opts['token'], "PX", opts['lockDuration'])
511
+ end
512
+ local optionalValues = {}
513
+ if opts['name'] then
514
+ -- Set "processedBy" field to the worker name
515
+ table.insert(optionalValues, "pb")
516
+ table.insert(optionalValues, opts['name'])
517
+ end
518
+ rcall("XADD", eventStreamKey, "*", "event", "active", "jobId", jobId, "prev", "waiting")
519
+ rcall("HMSET", jobKey, "processedOn", processedOn, unpack(optionalValues))
520
+ rcall("HINCRBY", jobKey, "ats", 1)
521
+ addBaseMarkerIfNeeded(markerKey, false)
522
+ return {rcall("HGETALL", jobKey), jobId, 0, 0} -- get job data
523
+ end
524
+ --[[
525
+ Updates the delay set, by moving delayed jobs that should
526
+ be processed now to "wait".
527
+ Events:
528
+ 'waiting'
529
+ ]]
530
+ -- Includes
531
+ -- Try to get as much as 1000 jobs at once
532
+ local function promoteDelayedJobs(delayedKey, markerKey, targetKey, prioritizedKey,
533
+ eventStreamKey, prefix, timestamp, priorityCounterKey, isPaused)
534
+ local jobs = rcall("ZRANGEBYSCORE", delayedKey, 0, (timestamp + 1) * 0x1000 - 1, "LIMIT", 0, 1000)
535
+ if (#jobs > 0) then
536
+ rcall("ZREM", delayedKey, unpack(jobs))
537
+ for _, jobId in ipairs(jobs) do
538
+ local jobKey = prefix .. jobId
539
+ local priority =
540
+ tonumber(rcall("HGET", jobKey, "priority")) or 0
541
+ if priority == 0 then
542
+ -- LIFO or FIFO
543
+ addJobInTargetList(targetKey, markerKey, "LPUSH", isPaused, jobId)
544
+ else
545
+ addJobWithPriority(markerKey, prioritizedKey, priority,
546
+ jobId, priorityCounterKey, isPaused)
547
+ end
548
+ -- Emit waiting event
549
+ rcall("XADD", eventStreamKey, "*", "event", "waiting", "jobId",
550
+ jobId, "prev", "delayed")
551
+ rcall("HSET", jobKey, "delay", 0)
552
+ end
553
+ end
554
+ end
522
555
  local function removeLock(jobKey, stalledKey, token, jobId)
523
556
  if token ~= "0" then
524
557
  local lockKey = jobKey .. ':lock'
@@ -1 +1 @@
1
- {"version":3,"file":"moveToFinished-14.js","sourceRoot":"","sources":["../../../src/scripts/moveToFinished-14.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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