@holo-js/queue-redis 0.3.23 → 0.3.24
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/dist/index.d.ts +1 -0
- package/dist/index.mjs +8 -2
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -40,6 +40,7 @@ declare class RedisQueueDriver implements QueueAsyncDriver {
|
|
|
40
40
|
private readonly reservations;
|
|
41
41
|
private queueCursor;
|
|
42
42
|
constructor(connection: NormalizedQueueRedisConnectionConfig, context: QueueDriverFactoryContext);
|
|
43
|
+
private getQueuePrefix;
|
|
43
44
|
private getQueue;
|
|
44
45
|
private createWorkerKey;
|
|
45
46
|
private normalizeReserveBlockFor;
|
package/dist/index.mjs
CHANGED
|
@@ -143,6 +143,9 @@ var RedisQueueDriver = class {
|
|
|
143
143
|
workerReadyPromises = /* @__PURE__ */ new Map();
|
|
144
144
|
reservations = /* @__PURE__ */ new Map();
|
|
145
145
|
queueCursor = 0;
|
|
146
|
+
getQueuePrefix(queueName) {
|
|
147
|
+
return this.bullConnection instanceof Redis.Cluster ? `{${queueName}}` : "bull";
|
|
148
|
+
}
|
|
146
149
|
getQueue(queueName) {
|
|
147
150
|
const cached = this.queues.get(queueName);
|
|
148
151
|
if (cached) {
|
|
@@ -150,6 +153,7 @@ var RedisQueueDriver = class {
|
|
|
150
153
|
}
|
|
151
154
|
const queue = new BullQueue(queueName, {
|
|
152
155
|
connection: this.bullConnection,
|
|
156
|
+
prefix: this.getQueuePrefix(queueName),
|
|
153
157
|
defaultJobOptions: {
|
|
154
158
|
removeOnComplete: true,
|
|
155
159
|
removeOnFail: true
|
|
@@ -190,6 +194,7 @@ var RedisQueueDriver = class {
|
|
|
190
194
|
autorun: false,
|
|
191
195
|
concurrency: 1,
|
|
192
196
|
connection: this.bullConnection,
|
|
197
|
+
prefix: this.getQueuePrefix(queueName),
|
|
193
198
|
drainDelay: this.resolveWorkerDrainDelay(blockFor),
|
|
194
199
|
lockDuration: this.connection.retryAfter * 1e3,
|
|
195
200
|
removeOnComplete: { count: 0 },
|
|
@@ -322,7 +327,8 @@ var RedisQueueDriver = class {
|
|
|
322
327
|
}
|
|
323
328
|
const token = `${workerId}:${randomUUID()}`;
|
|
324
329
|
const worker = await this.getWorker(blockingQueue, blockFor);
|
|
325
|
-
const
|
|
330
|
+
const queued = await worker.getNextJob(token, { block: false });
|
|
331
|
+
const job = queued ?? await worker.getNextJob(token, { block: true });
|
|
326
332
|
if (!job) {
|
|
327
333
|
return null;
|
|
328
334
|
}
|
|
@@ -357,7 +363,7 @@ var RedisQueueDriver = class {
|
|
|
357
363
|
let cleared = 0;
|
|
358
364
|
for (const queueName of queueNames) {
|
|
359
365
|
const queue = this.getQueue(queueName);
|
|
360
|
-
cleared += await queue.getJobCountByTypes("wait", "
|
|
366
|
+
cleared += await queue.getJobCountByTypes("wait", "paused", "prioritized", "delayed");
|
|
361
367
|
await queue.drain(true);
|
|
362
368
|
}
|
|
363
369
|
return cleared;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@holo-js/queue-redis",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.24",
|
|
4
4
|
"description": "Holo-JS Framework - Redis queue driver",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"test": "vitest --run"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
|
-
"@holo-js/queue": "^0.3.
|
|
26
|
+
"@holo-js/queue": "^0.3.24"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"bullmq": "^5.71.0",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"tslib": "^2.8.1"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@holo-js/queue": "^0.3.
|
|
34
|
+
"@holo-js/queue": "^0.3.24",
|
|
35
35
|
"@types/node": "^22.10.2",
|
|
36
36
|
"tsup": "^8.3.5",
|
|
37
37
|
"typescript": "^5.7.2",
|