power-queues 2.0.6 → 2.0.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.
package/dist/index.cjs CHANGED
@@ -280,7 +280,6 @@ var PowerQueues = class extends import_power_redis.PowerRedis {
280
280
  this.workerSelectionTimeoutMs = 80;
281
281
  this.workerMaxRetries = 5;
282
282
  this.workerClearAttemptsTimeoutMs = 864e5;
283
- this.workerStatusTimeoutMs = 864e5;
284
283
  }
285
284
  async onSelected(data) {
286
285
  return data;
@@ -351,10 +350,10 @@ var PowerQueues = class extends import_power_redis.PowerRedis {
351
350
  await this.redis.set(`${queueName}:${job}:ready`, 0);
352
351
  await this.redis.set(`${queueName}:${job}:err`, 0);
353
352
  await this.redis.set(`${queueName}:${job}:ok`, 0);
354
- await this.redis.pexpire(`${queueName}:${job}:total`, this.workerStatusTimeoutMs);
355
- await this.redis.pexpire(`${queueName}:${job}:ready`, this.workerStatusTimeoutMs);
356
- await this.redis.pexpire(`${queueName}:${job}:err`, this.workerStatusTimeoutMs);
357
- await this.redis.pexpire(`${queueName}:${job}:ok`, this.workerStatusTimeoutMs);
353
+ await this.redis.pexpire(`${queueName}:${job}:total`, opts.statusTimeoutMs || 864e5);
354
+ await this.redis.pexpire(`${queueName}:${job}:ready`, opts.statusTimeoutMs || 864e5);
355
+ await this.redis.pexpire(`${queueName}:${job}:err`, opts.statusTimeoutMs || 864e5);
356
+ await this.redis.pexpire(`${queueName}:${job}:ok`, opts.statusTimeoutMs || 864e5);
358
357
  }
359
358
  await Promise.all(runners);
360
359
  return result;
package/dist/index.d.cts CHANGED
@@ -14,6 +14,7 @@ type AddTasksOptions = {
14
14
  trimLimit?: number;
15
15
  id?: string;
16
16
  status?: boolean;
17
+ statusTimeoutMs?: number;
17
18
  idem?: boolean;
18
19
  };
19
20
  type Task = {
@@ -53,7 +54,6 @@ declare class PowerQueues extends PowerRedis {
53
54
  readonly workerSelectionTimeoutMs: number;
54
55
  readonly workerMaxRetries: number;
55
56
  readonly workerClearAttemptsTimeoutMs: number;
56
- readonly workerStatusTimeoutMs: number;
57
57
  onSelected(data: Array<[string, any[], number, string, string]>): Promise<[string, any[], number, string, string][]>;
58
58
  onExecute(id: string, payload: any, createdAt: number, job: string, key: string, attempt: number): Promise<void>;
59
59
  onExecuted(data: Array<[string, any[], number, string, string]>): Promise<void>;
package/dist/index.d.ts CHANGED
@@ -14,6 +14,7 @@ type AddTasksOptions = {
14
14
  trimLimit?: number;
15
15
  id?: string;
16
16
  status?: boolean;
17
+ statusTimeoutMs?: number;
17
18
  idem?: boolean;
18
19
  };
19
20
  type Task = {
@@ -53,7 +54,6 @@ declare class PowerQueues extends PowerRedis {
53
54
  readonly workerSelectionTimeoutMs: number;
54
55
  readonly workerMaxRetries: number;
55
56
  readonly workerClearAttemptsTimeoutMs: number;
56
- readonly workerStatusTimeoutMs: number;
57
57
  onSelected(data: Array<[string, any[], number, string, string]>): Promise<[string, any[], number, string, string][]>;
58
58
  onExecute(id: string, payload: any, createdAt: number, job: string, key: string, attempt: number): Promise<void>;
59
59
  onExecuted(data: Array<[string, any[], number, string, string]>): Promise<void>;
package/dist/index.js CHANGED
@@ -254,7 +254,6 @@ var PowerQueues = class extends PowerRedis {
254
254
  this.workerSelectionTimeoutMs = 80;
255
255
  this.workerMaxRetries = 5;
256
256
  this.workerClearAttemptsTimeoutMs = 864e5;
257
- this.workerStatusTimeoutMs = 864e5;
258
257
  }
259
258
  async onSelected(data) {
260
259
  return data;
@@ -325,10 +324,10 @@ var PowerQueues = class extends PowerRedis {
325
324
  await this.redis.set(`${queueName}:${job}:ready`, 0);
326
325
  await this.redis.set(`${queueName}:${job}:err`, 0);
327
326
  await this.redis.set(`${queueName}:${job}:ok`, 0);
328
- await this.redis.pexpire(`${queueName}:${job}:total`, this.workerStatusTimeoutMs);
329
- await this.redis.pexpire(`${queueName}:${job}:ready`, this.workerStatusTimeoutMs);
330
- await this.redis.pexpire(`${queueName}:${job}:err`, this.workerStatusTimeoutMs);
331
- await this.redis.pexpire(`${queueName}:${job}:ok`, this.workerStatusTimeoutMs);
327
+ await this.redis.pexpire(`${queueName}:${job}:total`, opts.statusTimeoutMs || 864e5);
328
+ await this.redis.pexpire(`${queueName}:${job}:ready`, opts.statusTimeoutMs || 864e5);
329
+ await this.redis.pexpire(`${queueName}:${job}:err`, opts.statusTimeoutMs || 864e5);
330
+ await this.redis.pexpire(`${queueName}:${job}:ok`, opts.statusTimeoutMs || 864e5);
332
331
  }
333
332
  await Promise.all(runners);
334
333
  return result;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "power-queues",
3
- "version": "2.0.6",
3
+ "version": "2.0.7",
4
4
  "description": "Base classes for implementing custom queues in redis under high load conditions based on nestjs.",
5
5
  "author": "ihor-bielchenko",
6
6
  "license": "MIT",