@pauldeng/node-red-contrib-bullmq 1.0.1 → 1.0.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.
- package/README.md +7 -3
- package/bull-queue.html +1 -1
- package/bull-queue.js +1 -1
- package/docs/COMMANDS.md +2 -0
- package/docs/CONNECTIONS.md +1 -1
- package/docs/MIGRATION.md +1 -1
- package/docs/NODE_GUIDE.md +1 -1
- package/docs/RELEASE.md +1 -1
- package/lib/acknowledgements.js +5 -4
- package/lib/commands.js +9 -4
- package/lib/connections.js +5 -0
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -8,11 +8,14 @@
|
|
|
8
8
|
|
|
9
9
|
Node-RED nodes for BullMQ-backed Redis job queues.
|
|
10
10
|
|
|
11
|
-
This package targets BullMQ 5.
|
|
11
|
+
This package targets BullMQ 5.80.2 and Node-RED 4.1 or 5.x. It preserves the legacy `bull-queue-server`, `bull cmd`, and `bull run` node types where BullMQ has compatible behavior, and adds `bull job`, `bull events`, and `bull flow`.
|
|
12
12
|
|
|
13
13
|
## Installation
|
|
14
14
|
|
|
15
|
+
To install - either use the manage palette option in the editor, or change to your Node-RED user directory.
|
|
16
|
+
|
|
15
17
|
```sh
|
|
18
|
+
cd ~/.node-red
|
|
16
19
|
npm install @pauldeng/node-red-contrib-bullmq
|
|
17
20
|
```
|
|
18
21
|
|
|
@@ -23,7 +26,7 @@ Repository: <https://github.com/pauldeng/node-red-contrib-bullmq>
|
|
|
23
26
|
- Node-RED 4.1.x or 5.x
|
|
24
27
|
- Node.js 18+ with Node-RED 4.1.x, or Node.js 22.9+ with Node-RED 5.x
|
|
25
28
|
- Redis with `maxmemory-policy=noeviction`
|
|
26
|
-
- BullMQ 5.
|
|
29
|
+
- BullMQ 5.80.2
|
|
27
30
|
|
|
28
31
|
Bull v4 Redis data is not automatically migrated. Drain, retire, or otherwise handle old Bull queues before upgrading the runtime dependency.
|
|
29
32
|
|
|
@@ -45,7 +48,7 @@ Supported deployment modes:
|
|
|
45
48
|
- AWS MemoryDB, configured as Redis Cluster with TLS
|
|
46
49
|
- Redis Sentinel
|
|
47
50
|
|
|
48
|
-
Authentication can use Redis ACL username/password. TLS supports CA, client certificate, client key, server name, and certificate verification. Cluster and MemoryDB
|
|
51
|
+
Authentication can use Redis ACL username/password. TLS supports CA, client certificate, client key, server name, and certificate verification. Cluster and MemoryDB prefixes must contain a hash tag, such as `{bull}`, to keep queue keys in one Redis Cluster slot for atomic operations.
|
|
49
52
|
|
|
50
53
|
## Legacy Repeat Cron Compatibility
|
|
51
54
|
|
|
@@ -122,3 +125,4 @@ Use [docs/TESTING.md](docs/TESTING.md) for Docker, Playwright, and MemoryDB test
|
|
|
122
125
|
- [Connection Guide](docs/CONNECTIONS.md)
|
|
123
126
|
- [Migration Guide](docs/MIGRATION.md)
|
|
124
127
|
- [Troubleshooting](docs/TROUBLESHOOTING.md)
|
|
128
|
+
- [Changelog](CHANGELOG.md)
|
package/bull-queue.html
CHANGED
|
@@ -161,7 +161,7 @@
|
|
|
161
161
|
<li><b>CA</b>: PEM certificate authority text for validating private Redis certificates. Stored as a Node-RED credential.</li>
|
|
162
162
|
<li><b>Client Cert</b>: PEM client certificate for mutual TLS deployments. Stored as a Node-RED credential.</li>
|
|
163
163
|
<li><b>Client Key</b>: PEM client private key for mutual TLS deployments. Stored as a Node-RED credential.</li>
|
|
164
|
-
<li><b>Prefix</b>: BullMQ key prefix.
|
|
164
|
+
<li><b>Prefix</b>: BullMQ key prefix. Redis Cluster and MemoryDB prefixes must contain a hash tag such as <code>{bull}</code> so BullMQ keys stay in one hash slot for atomic operations.</li>
|
|
165
165
|
</ul>
|
|
166
166
|
|
|
167
167
|
<h3>Example</h3>
|
package/bull-queue.js
CHANGED
|
@@ -86,7 +86,7 @@ function forceDisconnect(resource) {
|
|
|
86
86
|
}
|
|
87
87
|
// BullMQ resource. Its public disconnect() awaits a connection promise that
|
|
88
88
|
// never settles while Redis is unreachable, so reach for the underlying
|
|
89
|
-
// ioredis clients directly (BullMQ is pinned to exactly 5.
|
|
89
|
+
// ioredis clients directly (BullMQ is pinned to exactly 5.80.2).
|
|
90
90
|
if (resource.connection) {
|
|
91
91
|
disconnectClient(resource.connection._client);
|
|
92
92
|
}
|
package/docs/COMMANDS.md
CHANGED
|
@@ -82,6 +82,8 @@ Legacy lookup/removal is exact-id based.
|
|
|
82
82
|
- `getRateLimitTtl`
|
|
83
83
|
- `removeRateLimitKey`
|
|
84
84
|
|
|
85
|
+
`setGlobalRateLimit` requires `msg.max` and `msg.duration`; the documented `{ max, duration }` object in `msg.payload` is also accepted.
|
|
86
|
+
|
|
85
87
|
## Logs And Metrics
|
|
86
88
|
|
|
87
89
|
- `addJobLog`
|
package/docs/CONNECTIONS.md
CHANGED
|
@@ -12,7 +12,7 @@ Use deployment `cluster` and provide startup nodes as comma or newline separated
|
|
|
12
12
|
|
|
13
13
|
Cluster auth and TLS are applied through ioredis `redisOptions`. The runtime sets a DNS lookup passthrough for TLS-enabled cluster discovery.
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
The BullMQ prefix must contain a Redis hash tag, normally `{bull}`. Untagged Cluster prefixes are rejected to prevent `CROSSSLOT` failures.
|
|
16
16
|
|
|
17
17
|
## AWS MemoryDB
|
|
18
18
|
|
package/docs/MIGRATION.md
CHANGED
package/docs/NODE_GUIDE.md
CHANGED
|
@@ -10,7 +10,7 @@ Deployment modes:
|
|
|
10
10
|
- `cluster`: Redis Cluster and AWS MemoryDB.
|
|
11
11
|
- `sentinel`: Redis Sentinel.
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
Cluster and MemoryDB prefixes must contain a Redis hash tag; use `{bull}` unless you have a tested custom hash tag.
|
|
14
14
|
|
|
15
15
|
## `bull cmd`
|
|
16
16
|
|
package/docs/RELEASE.md
CHANGED
|
@@ -13,7 +13,7 @@ used here only for the one-time first publish.)
|
|
|
13
13
|
|
|
14
14
|
1. Confirm `package.json` has the intended `version` and the name `@pauldeng/node-red-contrib-bullmq`.
|
|
15
15
|
2. Confirm the GitHub repository is `https://github.com/pauldeng/node-red-contrib-bullmq`.
|
|
16
|
-
3. Confirm BullMQ is pinned to exactly `5.
|
|
16
|
+
3. Confirm BullMQ is pinned to exactly `5.80.2`.
|
|
17
17
|
4. Confirm no examples, docs, fixtures, or logs contain Redis, Sentinel, or MemoryDB secrets.
|
|
18
18
|
5. Update `CHANGELOG.md` for the new version.
|
|
19
19
|
|
package/lib/acknowledgements.js
CHANGED
|
@@ -5,7 +5,7 @@ const { EventEmitter, once } = require("node:events");
|
|
|
5
5
|
class AcknowledgementEntry {
|
|
6
6
|
constructor(context, timeoutMs) {
|
|
7
7
|
this.events = new EventEmitter();
|
|
8
|
-
this.
|
|
8
|
+
this.settlement = undefined;
|
|
9
9
|
this.job = context.job;
|
|
10
10
|
this.queue = context.queue;
|
|
11
11
|
this.queueName = context.queueName;
|
|
@@ -24,7 +24,8 @@ class AcknowledgementEntry {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
async wait() {
|
|
27
|
-
const
|
|
27
|
+
const settlement =
|
|
28
|
+
this.settlement || (await once(this.events, "settled"))[0];
|
|
28
29
|
if (settlement.type === "reject") {
|
|
29
30
|
throw settlement.error;
|
|
30
31
|
}
|
|
@@ -40,10 +41,10 @@ class AcknowledgementEntry {
|
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
settle(settlement) {
|
|
43
|
-
if (this.
|
|
44
|
+
if (this.settlement) {
|
|
44
45
|
return;
|
|
45
46
|
}
|
|
46
|
-
this.
|
|
47
|
+
this.settlement = settlement;
|
|
47
48
|
clearTimeout(this.timeout);
|
|
48
49
|
this.events.emit("settled", settlement);
|
|
49
50
|
}
|
package/lib/commands.js
CHANGED
|
@@ -56,7 +56,7 @@ async function dispatchStopAndRemoveAllJobs(queue) {
|
|
|
56
56
|
|
|
57
57
|
const cleaned = {};
|
|
58
58
|
for (const state of CLEAN_STATES) {
|
|
59
|
-
cleaned[state] = await queue.clean(0,
|
|
59
|
+
cleaned[state] = await queue.clean(0, 0, state);
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
return { removedSchedulers, cleaned };
|
|
@@ -102,7 +102,6 @@ async function dispatchCommand(queue, msg = {}) {
|
|
|
102
102
|
await queue.getDelayed(
|
|
103
103
|
valueOrDefault(msg.start, 0),
|
|
104
104
|
valueOrDefault(msg.end, -1),
|
|
105
|
-
valueOrDefault(msg.asc, false),
|
|
106
105
|
)
|
|
107
106
|
).map(serializeJob);
|
|
108
107
|
case "changeDelay": {
|
|
@@ -195,9 +194,15 @@ async function dispatchCommand(queue, msg = {}) {
|
|
|
195
194
|
return queue.getGlobalConcurrency();
|
|
196
195
|
case "removeGlobalConcurrency":
|
|
197
196
|
return queue.removeGlobalConcurrency();
|
|
198
|
-
case "setGlobalRateLimit":
|
|
199
|
-
|
|
197
|
+
case "setGlobalRateLimit": {
|
|
198
|
+
const max = msg.max ?? msg.payload?.max;
|
|
199
|
+
const duration = msg.duration ?? msg.payload?.duration;
|
|
200
|
+
if (max == null || duration == null) {
|
|
201
|
+
throw new Error("msg.max and msg.duration are required");
|
|
202
|
+
}
|
|
203
|
+
await queue.setGlobalRateLimit(max, duration);
|
|
200
204
|
return true;
|
|
205
|
+
}
|
|
201
206
|
case "getGlobalRateLimit":
|
|
202
207
|
return queue.getGlobalRateLimit();
|
|
203
208
|
case "removeGlobalRateLimit":
|
package/lib/connections.js
CHANGED
|
@@ -148,6 +148,11 @@ function normalizeQueueConfig(config = {}, credentials = {}) {
|
|
|
148
148
|
];
|
|
149
149
|
}
|
|
150
150
|
normalized.prefix = normalized.prefix || CLUSTER_PREFIX;
|
|
151
|
+
if (!/\{[^}]+\}/.test(normalized.prefix)) {
|
|
152
|
+
throw new Error(
|
|
153
|
+
"Cluster BullMQ prefix must contain a Redis hash tag such as {bull}",
|
|
154
|
+
);
|
|
155
|
+
}
|
|
151
156
|
}
|
|
152
157
|
|
|
153
158
|
if (deployment === "sentinel") {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pauldeng/node-red-contrib-bullmq",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "BullMQ-backed Redis job queue nodes for Node-RED",
|
|
5
5
|
"main": "bull-queue.js",
|
|
6
6
|
"files": [
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"validate": "npx --yes node-red-dev validate"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"bullmq": "5.
|
|
28
|
+
"bullmq": "5.80.2",
|
|
29
29
|
"ioredis": "5.10.1"
|
|
30
30
|
},
|
|
31
31
|
"license": "MIT",
|
|
@@ -62,9 +62,9 @@
|
|
|
62
62
|
"email": "dengpeng.cn@gmail.com"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
|
-
"@playwright/test": "1.
|
|
66
|
-
"node-red": "5.0.
|
|
65
|
+
"@playwright/test": "1.61.1",
|
|
66
|
+
"node-red": "5.0.1",
|
|
67
67
|
"node-red-node-test-helper": "^0.3.6",
|
|
68
|
-
"prettier": "3.
|
|
68
|
+
"prettier": "3.9.4"
|
|
69
69
|
}
|
|
70
70
|
}
|