bullmq 1.74.1 → 1.74.2

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.
@@ -0,0 +1,11 @@
1
+
2
+ --[[
3
+ Function to move job from wait state to active.
4
+ ]]
5
+
6
+ local function moveJobFromWaitToActive(priorityKey, eventsKey, jobKey, jobId, processedOn)
7
+ rcall("ZREM", priorityKey, jobId) -- remove from priority
8
+ rcall("XADD", eventsKey, "*", "event", "active", "jobId", jobId, "prev", "waiting")
9
+ rcall("HSET", jobKey, "processedOn", processedOn)
10
+ rcall("HINCRBY", jobKey, "attemptsMade", 1)
11
+ end
@@ -35,6 +35,9 @@
35
35
  local jobId
36
36
  local rcall = redis.call
37
37
 
38
+ -- Includes
39
+ --- @include "includes/moveJobFromWaitToActive"
40
+
38
41
  if(ARGV[5] ~= "") then
39
42
  jobId = ARGV[5]
40
43
 
@@ -88,12 +91,8 @@ if jobId then
88
91
 
89
92
  -- get a lock
90
93
  rcall("SET", lockKey, ARGV[2], "PX", ARGV[3])
91
- rcall("ZREM", KEYS[3], jobId) -- remove from priority
92
-
93
- rcall("XADD", KEYS[4], "*", "event", "active", "jobId", jobId, "prev", "waiting")
94
94
 
95
- rcall("HSET", jobKey, "processedOn", ARGV[4])
96
- rcall("HINCRBY", jobKey, "attemptsMade", 1)
95
+ moveJobFromWaitToActive(KEYS[3], KEYS[4], jobKey, jobId, ARGV[4])
97
96
 
98
97
  return {rcall("HGETALL", jobKey), jobId} -- get job data
99
98
  else
@@ -44,10 +44,11 @@
44
44
  local rcall = redis.call
45
45
 
46
46
  -- Includes
47
- --- @include "includes/updateParentDepsIfNeeded"
48
47
  --- @include "includes/destructureJobKey"
48
+ --- @include "includes/moveJobFromWaitToActive"
49
49
  --- @include "includes/removeJob"
50
50
  --- @include "includes/trimEvents"
51
+ --- @include "includes/updateParentDepsIfNeeded"
51
52
 
52
53
  local jobIdKey = KEYS[3]
53
54
  if rcall("EXISTS", jobIdKey) == 1 then -- // Make sure job exists
@@ -154,10 +155,7 @@ if rcall("EXISTS", jobIdKey) == 1 then -- // Make sure job exists
154
155
  rcall("SET", lockKey, ARGV[10], "PX", ARGV[11])
155
156
  end
156
157
 
157
- rcall("ZREM", KEYS[5], jobId) -- remove from priority
158
- rcall("XADD", KEYS[6], "*", "event", "active", "jobId", jobId,
159
- "prev", "waiting")
160
- rcall("HSET", jobKey, "processedOn", timestamp)
158
+ moveJobFromWaitToActive(KEYS[5], KEYS[6], jobKey, jobId, timestamp)
161
159
 
162
160
  return {rcall("HGETALL", jobKey), jobId} -- get job data
163
161
  else
@@ -0,0 +1,11 @@
1
+
2
+ --[[
3
+ Function to move job from wait state to active.
4
+ ]]
5
+
6
+ local function moveJobFromWaitToActive(priorityKey, eventsKey, jobKey, jobId, processedOn)
7
+ rcall("ZREM", priorityKey, jobId) -- remove from priority
8
+ rcall("XADD", eventsKey, "*", "event", "active", "jobId", jobId, "prev", "waiting")
9
+ rcall("HSET", jobKey, "processedOn", processedOn)
10
+ rcall("HINCRBY", jobKey, "attemptsMade", 1)
11
+ end
@@ -35,6 +35,9 @@
35
35
  local jobId
36
36
  local rcall = redis.call
37
37
 
38
+ -- Includes
39
+ --- @include "includes/moveJobFromWaitToActive"
40
+
38
41
  if(ARGV[5] ~= "") then
39
42
  jobId = ARGV[5]
40
43
 
@@ -88,12 +91,8 @@ if jobId then
88
91
 
89
92
  -- get a lock
90
93
  rcall("SET", lockKey, ARGV[2], "PX", ARGV[3])
91
- rcall("ZREM", KEYS[3], jobId) -- remove from priority
92
-
93
- rcall("XADD", KEYS[4], "*", "event", "active", "jobId", jobId, "prev", "waiting")
94
94
 
95
- rcall("HSET", jobKey, "processedOn", ARGV[4])
96
- rcall("HINCRBY", jobKey, "attemptsMade", 1)
95
+ moveJobFromWaitToActive(KEYS[3], KEYS[4], jobKey, jobId, ARGV[4])
97
96
 
98
97
  return {rcall("HGETALL", jobKey), jobId} -- get job data
99
98
  else
@@ -44,10 +44,11 @@
44
44
  local rcall = redis.call
45
45
 
46
46
  -- Includes
47
- --- @include "includes/updateParentDepsIfNeeded"
48
47
  --- @include "includes/destructureJobKey"
48
+ --- @include "includes/moveJobFromWaitToActive"
49
49
  --- @include "includes/removeJob"
50
50
  --- @include "includes/trimEvents"
51
+ --- @include "includes/updateParentDepsIfNeeded"
51
52
 
52
53
  local jobIdKey = KEYS[3]
53
54
  if rcall("EXISTS", jobIdKey) == 1 then -- // Make sure job exists
@@ -154,10 +155,7 @@ if rcall("EXISTS", jobIdKey) == 1 then -- // Make sure job exists
154
155
  rcall("SET", lockKey, ARGV[10], "PX", ARGV[11])
155
156
  end
156
157
 
157
- rcall("ZREM", KEYS[5], jobId) -- remove from priority
158
- rcall("XADD", KEYS[6], "*", "event", "active", "jobId", jobId,
159
- "prev", "waiting")
160
- rcall("HSET", jobKey, "processedOn", timestamp)
158
+ moveJobFromWaitToActive(KEYS[5], KEYS[6], jobKey, jobId, timestamp)
161
159
 
162
160
  return {rcall("HGETALL", jobKey), jobId} -- get job data
163
161
  else
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bullmq",
3
- "version": "1.74.1",
3
+ "version": "1.74.2",
4
4
  "description": "Queue for messages and jobs based on Redis",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",