Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-resque

Package Overview
Dependencies
Maintainers
4
Versions
179
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-resque - npm Package Compare versions

Comparing version 9.3.0 to 9.3.1

8

__tests__/core/connection.ts

@@ -98,10 +98,10 @@ import Redis from "ioredis";

prefixedConnection.key("testPrefixKey"),
"abc123"
"abc123",
);
const result = await connection.redis.get(
connection.key("testPrefixKey")
connection.key("testPrefixKey"),
);
const prefixedResult = await prefixedConnection.redis.get(
prefixedConnection.key("testPrefixKey")
prefixedConnection.key("testPrefixKey"),
);

@@ -139,3 +139,3 @@ expect(result).toBe("abc123");

expect(prefixedConnection.key("thing")).toBe(
specHelper.namespace + ":thing"
specHelper.namespace + ":thing",
);

@@ -142,0 +142,0 @@

@@ -23,3 +23,3 @@ import { Connection } from "../../src";

expect(error.message).toMatch(
/ENOTFOUND|ETIMEDOUT|ECONNREFUSED|EAI_AGAIN/
/ENOTFOUND|ETIMEDOUT|ECONNREFUSED|EAI_AGAIN/,
);

@@ -35,4 +35,4 @@ });

},
60 * 1000
60 * 1000,
);
});

@@ -64,3 +64,3 @@ import specHelper from "../utils/specHelper";

},
jobs
jobs,
);

@@ -111,3 +111,3 @@

},
10 * 1000
10 * 1000,
);

@@ -131,3 +131,3 @@

},
30 * 1000
30 * 1000,
);

@@ -145,3 +145,3 @@

expect(String(error)).toBe(
'Error: No job defined for class "missingJob"'
'Error: No job defined for class "missingJob"',
);

@@ -152,3 +152,3 @@ expect(duration).toBeGreaterThanOrEqual(0);

resolve(null);
}
},
);

@@ -155,0 +155,0 @@ });

@@ -19,3 +19,3 @@ import {

{ connection: specHelper.connectionDetails, queue: specHelper.queue },
{}
{},
);

@@ -31,3 +31,3 @@ await queue.connect();

{ connection: specHelper.connectionDetails, queue: specHelper.queue },
{}
{},
);

@@ -57,3 +57,3 @@ await queue.connect();

specHelper.namespace + ":delayed_queue_schedule",
"10"
"10",
);

@@ -63,3 +63,3 @@ expect(String(score)).toBe("10");

const str = await specHelper.redis.lpop(
specHelper.namespace + ":delayed:" + "10"
specHelper.namespace + ":delayed:" + "10",
);

@@ -77,3 +77,3 @@ expect(str).toBeDefined();

specHelper.namespace + ":delayed_queue_schedule",
"10"
"10",
);

@@ -83,3 +83,3 @@ expect(String(score)).toBe("10");

let str = await specHelper.redis.lpop(
specHelper.namespace + ":delayed:" + "10"
specHelper.namespace + ":delayed:" + "10",
);

@@ -95,5 +95,5 @@ expect(str).toBeDefined();

await expect(
queue.enqueueAt(10000, specHelper.queue, "someJob", [1, 2, 3])
queue.enqueueAt(10000, specHelper.queue, "someJob", [1, 2, 3]),
).rejects.toThrow(
/Job already enqueued at this time with same arguments/
/Job already enqueued at this time with same arguments/,
);

@@ -112,3 +112,3 @@

[1, 2, 3],
true
true,
); // no error

@@ -125,3 +125,3 @@

specHelper.namespace + ":delayed_queue_schedule",
now.toString()
now.toString(),
);

@@ -131,3 +131,3 @@ expect(String(score)).toBe(String(now));

let str = await specHelper.redis.lpop(
specHelper.namespace + ":delayed:" + now
specHelper.namespace + ":delayed:" + now,
);

@@ -147,3 +147,3 @@ expect(str).toBeDefined();

specHelper.namespace + ":delayed_queue_schedule",
now.toString()
now.toString(),
);

@@ -153,3 +153,3 @@ expect(String(score)).toBe(String(now));

let str = await specHelper.redis.lpop(
specHelper.namespace + ":delayed:" + now
specHelper.namespace + ":delayed:" + now,
);

@@ -183,3 +183,3 @@ expect(str).toBeDefined();

"someJob",
[1, 2, 3]
[1, 2, 3],
);

@@ -195,3 +195,3 @@ expect(timestamps.length).toBe(1);

"someJob",
[3, 2, 1]
[3, 2, 1],
);

@@ -226,3 +226,3 @@ expect(timestamps.length).toBe(0);

specHelper.queue,
"someJob1"
"someJob1",
);

@@ -239,3 +239,3 @@ const lengthFinally = await queue.length(specHelper.queue);

"someJob",
[1, 2, 3]
[1, 2, 3],
);

@@ -251,3 +251,3 @@ expect(timestamps.length).toBe(1);

"someJob",
[1, 2, 3]
[1, 2, 3],
);

@@ -305,3 +305,3 @@ const hash = await queue.allDelayed();

"noParams",
[]
[],
);

@@ -342,7 +342,7 @@ expect(timestamps.length).toBe(4);

specHelper.namespace + ":stat:failed",
1
1,
);
await queue.connection.redis.set(
specHelper.namespace + ":stat:processed",
2
2,
);

@@ -359,7 +359,7 @@

queue.connection.key("lock:lists:queueName:jobName:[{}]"),
123
123,
);
await queue.connection.redis.set(
queue.connection.key("workerslock:lists:queueName:jobName:[{}]"),
456
456,
);

@@ -370,6 +370,6 @@ });

await queue.connection.redis.del(
queue.connection.key("lock:lists:queueName:jobName:[{}]")
queue.connection.key("lock:lists:queueName:jobName:[{}]"),
);
await queue.connection.redis.del(
queue.connection.key("workerslock:lists:queueName:jobName:[{}]")
queue.connection.key("workerslock:lists:queueName:jobName:[{}]"),
);

@@ -389,3 +389,3 @@ });

const count = await queue.delLock(
"workerslock:lists:queueName:jobName:[{}]"
"workerslock:lists:queueName:jobName:[{}]",
);

@@ -415,11 +415,11 @@ expect(count).toBe(1);

queue.connection.key("failed"),
errorPayload(1)
errorPayload(1),
);
await queue.connection.redis.rpush(
queue.connection.key("failed"),
errorPayload(2)
errorPayload(2),
);
await queue.connection.redis.rpush(
queue.connection.key("failed"),
errorPayload(3)
errorPayload(3),
);

@@ -548,3 +548,3 @@ });

},
jobs
jobs,
);

@@ -559,3 +559,3 @@

},
jobs
jobs,
);

@@ -634,3 +634,3 @@

let str = await specHelper.redis.rpop(
specHelper.namespace + ":" + "failed"
specHelper.namespace + ":" + "failed",
);

@@ -640,3 +640,3 @@ const failedData = JSON.parse(str) as ParsedFailedJobPayload;

expect(failedData.exception).toBe(
"Worker Timeout (killed manually)"
"Worker Timeout (killed manually)",
);

@@ -694,3 +694,3 @@ expect(failedData.error).toBe("Worker Timeout (killed manually)");

expect(errorPayload.exception).toBe(
"Worker Timeout (killed manually)"
"Worker Timeout (killed manually)",
);

@@ -697,0 +697,0 @@ expect(errorPayload.backtrace[0]).toMatch(/killed by/);

@@ -102,3 +102,3 @@ import {

"someJob",
[1, 2, 3]
[1, 2, 3],
);

@@ -119,3 +119,3 @@ await scheduler.poll();

"someJob",
[1, 2, 3]
[1, 2, 3],
);

@@ -149,3 +149,3 @@ await scheduler.poll();

},
jobs
jobs,
);

@@ -179,3 +179,3 @@ await worker.connect();

expect(errorPayload.error).toEqual(
"Worker Timeout (killed manually)"
"Worker Timeout (killed manually)",
);

@@ -188,3 +188,3 @@

const str = await specHelper.redis.rpop(
specHelper.namespace + ":" + "failed"
specHelper.namespace + ":" + "failed",
);

@@ -194,3 +194,3 @@ const failed = JSON.parse(str) as ParsedFailedJobPayload;

expect(failed.exception).toBe(
"Worker Timeout (killed manually)"
"Worker Timeout (killed manually)",
);

@@ -201,3 +201,3 @@ expect(failed.error).toBe("Worker Timeout (killed manually)");

resolve(null);
}
},
);

@@ -204,0 +204,0 @@ });

@@ -71,3 +71,3 @@ import { ParsedFailedJobPayload, Job, Queue, Worker, Plugin } from "../../src";

{ connection: specHelper.connectionDetails, queues: [specHelper.queue] },
{}
{},
);

@@ -86,3 +86,3 @@ await worker.connect();

},
jobs
jobs,
);

@@ -153,3 +153,3 @@ });

},
jobs
jobs,
);

@@ -167,3 +167,3 @@ await worker.connect();

},
jobs
jobs,
);

@@ -190,3 +190,3 @@ await worker.connect();

},
jobs
jobs,
);

@@ -223,3 +223,3 @@

},
jobs
jobs,
);

@@ -308,3 +308,3 @@ await worker.connect();

expect(String(failure)).toBe(
'Error: No job defined for class "somethingFake"'
'Error: No job defined for class "somethingFake"',
);

@@ -321,3 +321,3 @@ expect(duration).toBeGreaterThanOrEqual(0);

let str = await specHelper.redis.rpop(
specHelper.namespace + ":" + "failed"
specHelper.namespace + ":" + "failed",
);

@@ -335,3 +335,3 @@ const data = JSON.parse(str) as ParsedFailedJobPayload;

await new Promise((resolve) =>
setTimeout(resolve, worker.options.timeout * 2)
setTimeout(resolve, worker.options.timeout * 2),
);

@@ -341,6 +341,6 @@ const pingKey = worker.connection.key(

"ping",
worker.name
worker.name,
);
const firstPayload = JSON.parse(
await specHelper.redis.get(pingKey)
await specHelper.redis.get(pingKey),
);

@@ -359,7 +359,7 @@ expect(firstPayload.name).toEqual(worker.name);

const secondPayload = JSON.parse(
await specHelper.redis.get(pingKey)
await specHelper.redis.get(pingKey),
);
expect(secondPayload.name).toEqual(worker.name);
expect(secondPayload.time).toBeGreaterThanOrEqual(
firstPayload.time
firstPayload.time,
);

@@ -366,0 +366,0 @@ });

@@ -51,3 +51,3 @@ import { Queue, Worker, Scheduler, Job } from "../../src";

},
jobs
jobs,
);

@@ -54,0 +54,0 @@ await worker.connect();

@@ -49,3 +49,3 @@ import { Queue, Worker, Scheduler, Job } from "../../src";

},
jobs
jobs,
);

@@ -52,0 +52,0 @@ await worker.connect();

@@ -23,3 +23,3 @@ import specHelper from "../utils/specHelper";

},
jobs
jobs,
);

@@ -31,3 +31,3 @@

"myJob",
[1, 2]
[1, 2],
);

@@ -34,0 +34,0 @@ expect(enqueueResponse).toBe(false);

@@ -38,3 +38,3 @@ import specHelper from "../utils/specHelper";

},
jobs
jobs,
);

@@ -61,3 +61,3 @@ queue.connect();

"-inf",
"+inf"
"+inf",
);

@@ -75,3 +75,3 @@ const queueLen = await queue.length(specHelper.queue);

"-inf",
"+inf"
"+inf",
);

@@ -78,0 +78,0 @@ const queueLen = await queue.length(specHelper.queue);

@@ -41,3 +41,3 @@ import specHelper from "../utils/specHelper";

},
jobs
jobs,
);

@@ -64,3 +64,3 @@ await queue.connect();

},
jobs
jobs,
);

@@ -73,3 +73,3 @@ worker2 = new Worker(

},
jobs
jobs,
);

@@ -136,3 +136,3 @@

"customKey",
Math.max.apply(Math.max, this.args)
Math.max.apply(Math.max, this.args),
);

@@ -155,3 +155,3 @@ return key;

},
functionJobs
functionJobs,
);

@@ -176,3 +176,3 @@ worker1.on("error", (error) => {

},
jobs
jobs,
);

@@ -185,3 +185,3 @@ worker2 = new Worker(

},
jobs
jobs,
);

@@ -209,3 +209,3 @@

":delayed:" +
Math.round(timestamps[0] / 1000)
Math.round(timestamps[0] / 1000),
);

@@ -240,3 +240,3 @@ expect(str).toBeDefined();

},
jobs
jobs,
);

@@ -249,3 +249,3 @@ worker2 = new Worker(

},
jobs
jobs,
);

@@ -294,3 +294,3 @@

},
jobs
jobs,
);

@@ -303,3 +303,3 @@ worker2 = new Worker(

},
jobs
jobs,
);

@@ -306,0 +306,0 @@

@@ -47,3 +47,3 @@ import specHelper from "../utils/specHelper";

},
jobs
jobs,
);

@@ -85,3 +85,3 @@ scheduler = new Scheduler({

},
jobs
jobs,
);

@@ -118,3 +118,3 @@

},
jobs
jobs,
);

@@ -121,0 +121,0 @@

@@ -65,3 +65,3 @@ import specHelper from "../utils/specHelper";

},
jobs
jobs,
);

@@ -108,3 +108,3 @@ await queue.connect();

const result = await specHelper.redis.keys(
specHelper.namespace + ":lock*"
specHelper.namespace + ":lock*",
);

@@ -119,3 +119,3 @@ expect(result).toHaveLength(1);

specHelper.queue +
":[1,2]"
":[1,2]",
);

@@ -131,4 +131,4 @@ expect(ttl).toBe(specHelper.timeout);

resolve,
Math.min((specHelper.smallTimeout + 1) * 1000, 4000)
)
Math.min((specHelper.smallTimeout + 1) * 1000, 4000),
),
);

@@ -143,3 +143,3 @@ const tryTwo = await queue.enqueue(specHelper.queue, stuckJob, [1, 2]);

const result = await specHelper.redis.keys(
specHelper.namespace + ":lock*"
specHelper.namespace + ":lock*",
);

@@ -154,3 +154,3 @@ expect(result).toHaveLength(1);

specHelper.queue +
":[1,2]"
":[1,2]",
);

@@ -170,3 +170,3 @@ expect(ttl).toBe(specHelper.smallTimeout);

},
jobs
jobs,
);

@@ -184,3 +184,3 @@

"uniqueJob",
[1, 2]
[1, 2],
);

@@ -193,3 +193,3 @@ expect(enqueue).toBe(true);

const result = await specHelper.redis.keys(
specHelper.namespace + ":lock*"
specHelper.namespace + ":lock*",
);

@@ -203,3 +203,3 @@ expect(result).toHaveLength(0);

"blockingJob",
[1, 2]
[1, 2],
);

@@ -212,3 +212,3 @@ expect(enqueue).toBe(true);

const result = await specHelper.redis.keys(
specHelper.namespace + ":lock*"
specHelper.namespace + ":lock*",
);

@@ -215,0 +215,0 @@ expect(result).toHaveLength(0);

@@ -52,3 +52,3 @@ import specHelper from "../utils/specHelper";

},
jobs
jobs,
);

@@ -86,3 +86,3 @@ scheduler = new Scheduler({

},
jobs
jobs,
);

@@ -98,3 +98,3 @@

const length = await specHelper.redis.llen(
`${specHelper.namespace}:failed`
`${specHelper.namespace}:failed`,
);

@@ -125,3 +125,3 @@ expect(length).toBe(0);

},
jobs
jobs,
);

@@ -142,3 +142,3 @@

const length = await specHelper.redis.llen(
`${specHelper.namespace}:failed`
`${specHelper.namespace}:failed`,
);

@@ -184,3 +184,3 @@ expect(length).toBe(1);

},
customJobs
customJobs,
);

@@ -201,3 +201,3 @@

const length = await specHelper.redis.llen(
`${specHelper.namespace}:failed`
`${specHelper.namespace}:failed`,
);

@@ -244,3 +244,3 @@ expect(length).toBe(1);

},
customJobs
customJobs,
);

@@ -261,3 +261,3 @@

const length = await specHelper.redis.llen(
`${specHelper.namespace}:failed`
`${specHelper.namespace}:failed`,
);

@@ -283,3 +283,3 @@ expect(length).toBe(1);

},
jobs
jobs,
);

@@ -292,7 +292,7 @@

"brokenJob",
[1, 2]
[1, 2],
);
expect(timestamps.length).toBe(1);
const length = await specHelper.redis.llen(
`${specHelper.namespace}:failed`
`${specHelper.namespace}:failed`,
);

@@ -318,3 +318,3 @@ expect(length).toBe(0);

},
jobs
jobs,
);

@@ -326,12 +326,12 @@

const globalProcessed = await specHelper.redis.get(
`${specHelper.namespace}:stat:processed`
`${specHelper.namespace}:stat:processed`,
);
const globalFailed = await specHelper.redis.get(
`${specHelper.namespace}:stat:failed`
`${specHelper.namespace}:stat:failed`,
);
const workerProcessed = await specHelper.redis.get(
`${specHelper.namespace}:stat:processed:${worker.name}`
`${specHelper.namespace}:stat:processed:${worker.name}`,
);
const workerFailed = await specHelper.redis.get(
`${specHelper.namespace}:stat:failed:${worker.name}`
`${specHelper.namespace}:stat:failed:${worker.name}`,
);

@@ -360,3 +360,3 @@ expect(String(globalProcessed)).toBe("0");

},
jobs
jobs,
);

@@ -367,6 +367,6 @@

const retryAttempts = await specHelper.redis.get(
`${specHelper.namespace}:resque-retry:brokenJob:1-2`
`${specHelper.namespace}:resque-retry:brokenJob:1-2`,
);
let failureData = await specHelper.redis.get(
`${specHelper.namespace}:failure-resque-retry:brokenJob:1-2`
`${specHelper.namespace}:failure-resque-retry:brokenJob:1-2`,
);

@@ -373,0 +373,0 @@ expect(String(retryAttempts)).toBe("0");

@@ -32,3 +32,3 @@ import Redis from "ioredis";

this.connectionDetails.host,
this.connectionDetails.options
this.connectionDetails.options,
);

@@ -75,3 +75,3 @@

},
jobs
jobs,
);

@@ -78,0 +78,0 @@ await this.worker.connect();

@@ -50,3 +50,3 @@ "use strict";

return toRun;
await this.connection.redis
const response = await this.connection.redis
.multi()

@@ -56,2 +56,7 @@ .sadd(this.connection.key("queues"), q)

.exec();
response.forEach((res) => {
if (res[0] !== null) {
throw res[0];
}
});
await (0, pluginRunner_1.RunPlugins)(this, "afterEnqueue", func, q, job, args);

@@ -80,3 +85,3 @@ return toRun;

}
await this.connection.redis
const response = await this.connection.redis
.multi()

@@ -87,2 +92,7 @@ .rpush(this.connection.key("delayed:" + rTimestamp), item)

.exec();
response.forEach((res) => {
if (res[0] !== null) {
throw res[0];
}
});
}

@@ -109,3 +119,3 @@ /**

const { redis } = this.connection;
await redis
const response = await redis
.multi()

@@ -115,2 +125,7 @@ .del(this.connection.key("queue", q))

.exec();
response.forEach((res) => {
if (res[0] !== null) {
throw res[0];
}
});
}

@@ -155,3 +170,8 @@ /**

}
await pipeline.exec();
const response = await pipeline.exec();
response.forEach((res) => {
if (res[0] !== null) {
throw res[0];
}
});
return numJobsDeleted;

@@ -173,3 +193,8 @@ }

}
await pipeline.exec();
const response = await pipeline.exec();
response.forEach((res) => {
if (res[0] !== null) {
throw res[0];
}
});
return timestamps.map((t) => parseInt(t, 10));

@@ -367,3 +392,8 @@ }

}
await pipeline.exec();
const response = await pipeline.exec();
response.forEach((res) => {
if (res[0] !== null) {
throw res[0];
}
});
return errorPayload;

@@ -370,0 +400,0 @@ }

@@ -166,3 +166,3 @@ "use strict";

if (length === 0) {
await this.connection.redis
const response = await this.connection.redis
.multi()

@@ -172,2 +172,7 @@ .del(key)

.exec();
response.forEach((res) => {
if (res[0] !== null) {
throw res[0];
}
});
}

@@ -213,4 +218,5 @@ await this.unwatchIfPossible();

var _a, _b;
if (((_b = (_a = this.connection.redis) === null || _a === void 0 ? void 0 : _a.constructor) === null || _b === void 0 ? void 0 : _b.name) === "RedisMock")
if (["RedisMock", "_RedisMock"].includes((_b = (_a = this.connection.redis) === null || _a === void 0 ? void 0 : _a.constructor) === null || _b === void 0 ? void 0 : _b.name)) {
return false;
}
if (typeof this.connection.redis.unwatch !== "function")

@@ -217,0 +223,0 @@ return false;

@@ -246,3 +246,3 @@ "use strict";

async succeed(job, duration) {
await this.connection.redis
const response = await this.connection.redis
.multi()

@@ -252,6 +252,11 @@ .incr(this.connection.key("stat", "processed"))

.exec();
response.forEach((res) => {
if (res[0] !== null) {
throw res[0];
}
});
this.emit("success", this.queue, job, this.result, duration);
}
async fail(err, duration) {
await this.connection.redis
const response = await this.connection.redis
.multi()

@@ -262,2 +267,7 @@ .incr(this.connection.key("stat", "failed"))

.exec();
response.forEach((res) => {
if (res[0] !== null) {
throw res[0];
}
});
this.emit("failure", this.queue, this.job, err, duration);

@@ -325,3 +335,3 @@ }

}
await this.connection.redis
const response = await this.connection.redis
.multi()

@@ -335,2 +345,7 @@ .srem(this.connection.key("workers"), name + ":" + queues)

.exec();
response.forEach((res) => {
if (res[0] !== null) {
throw res[0];
}
});
}

@@ -337,0 +352,0 @@ async checkQueues() {

@@ -69,3 +69,3 @@ #!/usr/bin/env ts-node

{ connection, queues: ["math", "otherQueue"] },
jobs
jobs,
);

@@ -110,3 +110,5 @@ await worker.connect();

console.log(
`job success ${queue} ${JSON.stringify(job)} >> ${result} (${duration}ms)`
`job success ${queue} ${JSON.stringify(
job,
)} >> ${result} (${duration}ms)`,
);

@@ -117,4 +119,4 @@ });

`job failure ${queue} ${JSON.stringify(
job
)} >> ${failure} (${duration}ms)`
job,
)} >> ${failure} (${duration}ms)`,
);

@@ -146,3 +148,3 @@ });

console.log(
`failing ${workerName} (stuck for ${delta}s) and failing job ${errorPayload}`
`failing ${workerName} (stuck for ${delta}s) and failing job ${errorPayload}`,
);

@@ -149,0 +151,0 @@ });

@@ -87,3 +87,3 @@ #!/usr/bin/env ts-node

{ connection: connectionDetails, queues: ["default"] },
jobs
jobs,
);

@@ -90,0 +90,0 @@ await worker.connect();

@@ -42,3 +42,3 @@ import { Queue } from "node-resque";

console.error(
`Process did not terminate within ${timeout}ms. Stopping now!`
`Process did not terminate within ${timeout}ms. Stopping now!`,
);

@@ -45,0 +45,0 @@ process.nextTick(() => process.exit(1));

@@ -33,3 +33,3 @@ import { Worker, Scheduler } from "node-resque";

{ connection: connectionDetails, queues: ["math", "otherQueue"] },
jobs
jobs,
);

@@ -62,3 +62,5 @@ await worker.connect();

console.log(
`job success ${queue} ${JSON.stringify(job)} >> ${result} (${duration}ms)`
`job success ${queue} ${JSON.stringify(
job,
)} >> ${result} (${duration}ms)`,
);

@@ -69,4 +71,4 @@ });

`job failure ${queue} ${JSON.stringify(
job
)} >> ${failure} (${duration}ms)`
job,
)} >> ${failure} (${duration}ms)`,
);

@@ -102,3 +104,3 @@ });

console.log(
`failing ${workerName} (stuck for ${delta}s) and failing job ${errorPayload}`
`failing ${workerName} (stuck for ${delta}s) and failing job ${errorPayload}`,
);

@@ -111,3 +113,3 @@ });

console.log(
`scheduler enqueuing job ${timestamp} >> ${JSON.stringify(job)}`
`scheduler enqueuing job ${timestamp} >> ${JSON.stringify(job)}`,
);

@@ -129,3 +131,3 @@ });

console.error(
`Process did not terminate within ${timeout}ms. Stopping now!`
`Process did not terminate within ${timeout}ms. Stopping now!`,
);

@@ -132,0 +134,0 @@ process.nextTick(() => process.exit(1));

@@ -60,3 +60,3 @@ #!/usr/bin/env ts-node

{ connection: connectionDetails, queues: ["default"] },
jobs
jobs,
);

@@ -63,0 +63,0 @@ await worker.connect();

@@ -71,3 +71,3 @@ #!/usr/bin/env ts-node

{ connection: connectionDetails, queues: ["math", "otherQueue"] },
jobs
jobs,
);

@@ -112,3 +112,5 @@ await worker.connect();

console.log(
`job success ${queue} ${JSON.stringify(job)} >> ${result} (${duration}ms)`
`job success ${queue} ${JSON.stringify(
job,
)} >> ${result} (${duration}ms)`,
);

@@ -119,4 +121,4 @@ });

`job failure ${queue} ${JSON.stringify(
job
)} >> ${failure} (${duration}ms)`
job,
)} >> ${failure} (${duration}ms)`,
);

@@ -148,3 +150,3 @@ });

console.log(
`failing ${workerName} (stuck for ${delta}s) and failing job ${errorPayload}`
`failing ${workerName} (stuck for ${delta}s) and failing job ${errorPayload}`,
);

@@ -151,0 +153,0 @@ });

@@ -76,3 +76,3 @@ #!/usr/bin/env ts-node

{ connection: connectionDetails, queues: ["math", "otherQueue"] },
jobs
jobs,
);

@@ -117,3 +117,5 @@ await worker.connect();

console.log(
`job success ${queue} ${JSON.stringify(job)} >> ${result} (${duration}ms)`
`job success ${queue} ${JSON.stringify(
job,
)} >> ${result} (${duration}ms)`,
);

@@ -124,4 +126,4 @@ });

`job failure ${queue} ${JSON.stringify(
job
)} >> ${failure} (${duration}ms)`
job,
)} >> ${failure} (${duration}ms)`,
);

@@ -153,3 +155,3 @@ });

console.log(
`failing ${workerName} (stuck for ${delta}s) and failing job ${errorPayload}`
`failing ${workerName} (stuck for ${delta}s) and failing job ${errorPayload}`,
);

@@ -156,0 +158,0 @@ });

@@ -93,3 +93,3 @@ #!/usr/bin/env ts-node

},
jobs
jobs,
);

@@ -112,3 +112,3 @@

console.log(
`worker[${workerId}] working job ${queue} ${JSON.stringify(job)}`
`worker[${workerId}] working job ${queue} ${JSON.stringify(job)}`,
);

@@ -119,4 +119,4 @@ });

`worker[${workerId}] reEnqueue job (${plugin}) ${queue} ${JSON.stringify(
job
)}`
job,
)}`,
);

@@ -127,4 +127,4 @@ });

`worker[${workerId}] job success ${queue} ${JSON.stringify(
job
)} >> ${result} (${duration}ms)`
job,
)} >> ${result} (${duration}ms)`,
);

@@ -135,4 +135,4 @@ });

`worker[${workerId}] job failure ${queue} ${JSON.stringify(
job
)} >> ${failure} (${duration}ms)`
job,
)} >> ${failure} (${duration}ms)`,
);

@@ -142,3 +142,3 @@ });

console.log(
`worker[${workerId}] error ${queue} ${JSON.stringify(job)} >> ${error}`
`worker[${workerId}] error ${queue} ${JSON.stringify(job)} >> ${error}`,
);

@@ -153,3 +153,3 @@ });

console.log(
`*** checked for worker status: ${verb} (event loop delay: ${delay}ms)`
`*** checked for worker status: ${verb} (event loop delay: ${delay}ms)`,
);

@@ -156,0 +156,0 @@ });

@@ -50,3 +50,3 @@ #!/usr/bin/env ts-node

{ connection: connectionDetails, queues: ["math", "otherQueue"] },
jobs
jobs,
);

@@ -53,0 +53,0 @@ await worker.connect();

@@ -54,3 +54,3 @@ #!/usr/bin/env ts-node

{ connection: connectionDetails, queues: ["math"] },
jobs
jobs,
);

@@ -101,3 +101,3 @@ await worker.connect();

console.log(
"job failure " + queue + " " + JSON.stringify(job) + " >> " + failure
"job failure " + queue + " " + JSON.stringify(job) + " >> " + failure,
);

@@ -104,0 +104,0 @@ setTimeout(process.exit, 2000);

@@ -44,3 +44,3 @@ #!/usr/bin/env ts-node

{ connection: connectionDetails, queues: ["time"] },
jobs
jobs,
);

@@ -47,0 +47,0 @@ await worker.connect();

@@ -46,3 +46,3 @@ #!/usr/bin/env ts-node

{ connection: connectionDetails, queues: ["stuckJobs"] },
jobs
jobs,
);

@@ -127,4 +127,4 @@ await worker.connect();

`failing ${workerName} (stuck for ${delta}s) and failing job: ${JSON.stringify(
errorPayload
)}`
errorPayload,
)}`,
);

@@ -131,0 +131,0 @@ process.exit();

@@ -6,3 +6,3 @@ {

"license": "Apache-2.0",
"version": "9.3.0",
"version": "9.3.1",
"homepage": "http://github.com/actionhero/node-resque",

@@ -30,15 +30,15 @@ "repository": {

"dependencies": {
"ioredis": "^5.2.1"
"ioredis": "^5.3.2"
},
"devDependencies": {
"@types/jest": "^28.1.6",
"@types/node": "^18.0.6",
"ioredis-mock": "^8.2.2",
"jest": "^28.1.3",
"node-schedule": "^2.1.0",
"prettier": "^2.7.1",
"ts-jest": "^28.0.7",
"@types/jest": "^29.5.3",
"@types/node": "^20.4.8",
"ioredis-mock": "^8.8.1",
"jest": "^29.6.2",
"node-schedule": "^2.1.1",
"prettier": "^3.0.1",
"ts-jest": "^29.1.1",
"ts-node": "^10.9.1",
"typedoc": "^0.23.8",
"typescript": "^4.7.4"
"typedoc": "^0.24.8",
"typescript": "^5.1.6"
},

@@ -45,0 +45,0 @@ "scripts": {

@@ -114,3 +114,3 @@ # node-resque: The best background jobs in node.

{ connection: connectionDetails, queues: ["math", "otherQueue"] },
jobs
jobs,
);

@@ -155,3 +155,5 @@ await worker.connect();

console.log(
`job success ${queue} ${JSON.stringify(job)} >> ${result} (${duration}ms)`
`job success ${queue} ${JSON.stringify(
job,
)} >> ${result} (${duration}ms)`,
);

@@ -162,4 +164,4 @@ });

`job failure ${queue} ${JSON.stringify(
job
)} >> ${failure} (${duration}ms)`
job,
)} >> ${failure} (${duration}ms)`,
);

@@ -191,3 +193,3 @@ });

console.log(
`failing ${workerName} (stuck for ${delta}s) and failing job ${errorPayload}`
`failing ${workerName} (stuck for ${delta}s) and failing job ${errorPayload}`,
);

@@ -270,3 +272,3 @@ });

{ connection: connectionDetails, queues: "math" },
jobs
jobs,
);

@@ -301,3 +303,3 @@

{ connection: connectionDetails, queues: "math" },
jobs
jobs,
);

@@ -335,3 +337,3 @@

{ connection: connectionDetails, queues: "math", name: name },
jobs
jobs,
);

@@ -564,3 +566,3 @@ ```

},
jobs
jobs,
);

@@ -586,3 +588,3 @@

console.log(
"worker[" + workerId + "] working job " + queue + " " + JSON.stringify(job)
"worker[" + workerId + "] working job " + queue + " " + JSON.stringify(job),
);

@@ -599,3 +601,3 @@ });

" " +
JSON.stringify(job)
JSON.stringify(job),
);

@@ -612,3 +614,3 @@ });

" >> " +
result
result,
);

@@ -625,3 +627,3 @@ });

" >> " +
failure
failure,
);

@@ -638,3 +640,3 @@ });

" >> " +
error
error,
);

@@ -651,3 +653,3 @@ });

delay +
"ms)"
"ms)",
);

@@ -672,3 +674,3 @@ });

This package was featured heavily in [this presentation I gave](https://blog.evantahler.com/background-tasks-in-node-js-a-survey-with-redis-971d3575d9d2#.rzph5ofgy) about background jobs + node.js. It contains more examples!
This package was featured heavily in [this presentation I gave](https://www.evantahler.com/blog/post/2016-05-11-background-tasks-in-nodejs-a-survey-with-redis) about background jobs + node.js. It contains more examples!

@@ -675,0 +677,0 @@ ## Acknowledgments

@@ -60,3 +60,3 @@ import { EventEmitter } from "events";

this.options.host,
this.options.options
this.options.options,
);

@@ -68,3 +68,3 @@ } else {

this.options.host,
this.options.options
this.options.options,
);

@@ -116,3 +116,3 @@ }

keysAry: string[] = [],
cursor = 0
cursor = 0,
): Promise<string[]> {

@@ -129,3 +129,3 @@ if (count === null || count === undefined) {

"COUNT",
count
count,
);

@@ -143,4 +143,4 @@ if (matches && matches.length > 0) {

new Error(
"You must establish a connection to redis before running the getKeys command."
)
"You must establish a connection to redis before running the getKeys command.",
),
);

@@ -147,0 +147,0 @@ }

@@ -25,3 +25,3 @@ import { EventEmitter } from "events";

event: "cleaning_worker",
cb: (workerId: number, worker: Worker, pid: number) => void
cb: (workerId: number, worker: Worker, pid: number) => void,
): this;

@@ -32,3 +32,3 @@ on(event: "poll", cb: (workerId: number, queue: string) => void): this;

event: "job",
cb: (workerId: number, queue: string, job: ParsedJob) => void
cb: (workerId: number, queue: string, job: ParsedJob) => void,
): this;

@@ -41,4 +41,4 @@ on(

job: ParsedJob,
plugin: string
) => void
plugin: string,
) => void,
): this;

@@ -52,4 +52,4 @@ on(

result: any,
duration: number
) => void
duration: number,
) => void,
): this;

@@ -63,8 +63,8 @@ on(

failure: Error,
duration: number
) => void
duration: number,
) => void,
): this;
on(
event: "error",
cb: (error: Error, workerId: number, queue: string, job: ParsedJob) => void
cb: (error: Error, workerId: number, queue: string, job: ParsedJob) => void,
): this;

@@ -74,3 +74,3 @@ on(event: "pause", cb: (workerId: number) => void): this;

event: "multiWorkerAction",
cb: (verb: string, delay: number) => void
cb: (verb: string, delay: number) => void,
): this;

@@ -95,3 +95,3 @@ }

options.connection.redis.setMaxListeners(
options.connection.redis.getMaxListeners() + options.maxTaskProcessors
options.connection.redis.getMaxListeners() + options.maxTaskProcessors,
);

@@ -123,3 +123,3 @@ }

this.eventLoopCheckCounter++;
}
},
);

@@ -138,3 +138,3 @@ }

},
this.jobs
this.jobs,
);

@@ -253,3 +253,3 @@

return resolve(null);
})
}),
);

@@ -256,0 +256,0 @@ });

@@ -25,3 +25,3 @@ import { Worker } from "./worker";

[key: string]: any;
}
},
) {

@@ -28,0 +28,0 @@ this.name = this?.constructor?.name || "Node Resque Plugin";

@@ -17,3 +17,3 @@ import { Job } from "../types/job";

args: Array<any>,
pluginCounter?: number
pluginCounter?: number,
): Promise<boolean> {

@@ -39,3 +39,3 @@ if (!job) return true;

job,
args
args,
);

@@ -55,3 +55,3 @@ pluginCounter++;

job: Job<unknown>,
args: Array<any>
args: Array<any>,
): Promise<boolean> {

@@ -58,0 +58,0 @@ if (!job) return true;

@@ -89,3 +89,3 @@ import { EventEmitter } from "events";

await this.connection.redis
const response = await this.connection.redis
.multi()

@@ -96,2 +96,8 @@ .sadd(this.connection.key("queues"), q)

response.forEach((res) => {
if (res[0] !== null) {
throw res[0];
}
});
await RunPlugins(this, "afterEnqueue", func, q, job, args);

@@ -111,3 +117,3 @@ return toRun;

args: Array<any> = [],
suppressDuplicateTaskError = false
suppressDuplicateTaskError = false,
) {

@@ -122,3 +128,3 @@ // Don't run plugins here, they should be run by scheduler at the enqueue step

this.connection.key("timestamps:" + item),
match
match,
);

@@ -131,3 +137,3 @@

throw new Error(
"Job already enqueued at this time with same arguments"
"Job already enqueued at this time with same arguments",
);

@@ -137,3 +143,3 @@ }

await this.connection.redis
const response = await this.connection.redis
.multi()

@@ -145,5 +151,11 @@ .rpush(this.connection.key("delayed:" + rTimestamp), item)

rTimestamp,
rTimestamp.toString()
rTimestamp.toString(),
)
.exec();
response.forEach((res) => {
if (res[0] !== null) {
throw res[0];
}
});
}

@@ -160,3 +172,3 @@ /**

args: Array<any> = [],
suppressDuplicateTaskError = false
suppressDuplicateTaskError = false,
) {

@@ -179,3 +191,3 @@ const timestamp = new Date().getTime() + parseInt(time.toString(), 10);

const { redis } = this.connection;
await redis
const response = await redis
.multi()

@@ -185,2 +197,8 @@ .del(this.connection.key("queue", q))

.exec();
response.forEach((res) => {
if (res[0] !== null) {
throw res[0];
}
});
}

@@ -205,3 +223,3 @@

count,
this.encode(q, func, args)
this.encode(q, func, args),
);

@@ -225,3 +243,3 @@ }

start: number = 0,
stop: number = -1
stop: number = -1,
) {

@@ -231,3 +249,3 @@ const jobs = await this.connection.redis.lrange(

start,
stop
stop,
);

@@ -246,3 +264,10 @@ let numJobsDeleted: number = 0;

await pipeline.exec();
const response = await pipeline.exec();
response.forEach((res) => {
if (res[0] !== null) {
throw res[0];
}
});
return numJobsDeleted;

@@ -257,3 +282,3 @@ }

const members = await this.connection.redis.smembers(
this.connection.key("timestamps:" + search)
this.connection.key("timestamps:" + search),
);

@@ -268,3 +293,3 @@

0,
search
search,
);

@@ -277,3 +302,10 @@ if (count > 0) {

await pipeline.exec();
const response = await pipeline.exec();
response.forEach((res) => {
if (res[0] !== null) {
throw res[0];
}
});
return timestamps.map((t) => parseInt(t, 10));

@@ -292,3 +324,3 @@ }

const members = await this.connection.redis.smembers(
this.connection.key("timestamps:" + search)
this.connection.key("timestamps:" + search),
);

@@ -308,3 +340,3 @@ members.forEach((key) => {

const timestamps = await this.connection.getKeys(
this.connection.key("delayed:*")
this.connection.key("delayed:*"),
);

@@ -328,3 +360,3 @@ timestamps.forEach((timestamp) => {

0,
-1
-1,
);

@@ -345,3 +377,3 @@ const tasks = items.map((i) => {

start,
stop
stop,
);

@@ -422,3 +454,3 @@ const tasks = items.map(function (i) {

const results = await this.connection.redis.smembers(
this.connection.key("workers")
this.connection.key("workers"),
);

@@ -452,3 +484,3 @@ results.forEach(function (r) {

return this.connection.redis.get(
this.connection.key("worker", fullWorkerName)
this.connection.key("worker", fullWorkerName),
);

@@ -487,3 +519,3 @@ }

"error",
`force-cleaning worker ${workerName}, but cannot find queues`
`force-cleaning worker ${workerName}, but cannot find queues`,
);

@@ -524,8 +556,14 @@ } else {

this.connection.key("failed"),
JSON.stringify(errorPayload)
JSON.stringify(errorPayload),
);
}
await pipeline.exec();
const response = await pipeline.exec();
response.forEach((res) => {
if (res[0] !== null) {
throw res[0];
}
});
return errorPayload;

@@ -577,3 +615,3 @@ }

start,
stop
stop,
);

@@ -591,3 +629,3 @@ const results = data.map((i) => {

1,
JSON.stringify(failedJob)
JSON.stringify(failedJob),
);

@@ -604,3 +642,3 @@ }

failedJob.payload.class,
failedJob.payload.args
failedJob.payload.args,
);

@@ -607,0 +645,0 @@ }

@@ -25,3 +25,3 @@ // To read notes about the leader locking scheme, check out:

event: "cleanStuckWorker",
cb: (workerName: string, errorPayload: ErrorPayload, delta: number) => void
cb: (workerName: string, errorPayload: ErrorPayload, delta: number) => void,
): this;

@@ -32,3 +32,3 @@ on(event: "error", cb: (error: Error, queue: string) => void): this;

event: "transferredJob",
cb: (timestamp: number, job: Job<any>) => void
cb: (timestamp: number, job: Job<any>) => void,
): this;

@@ -39,3 +39,3 @@

event: "cleanStuckWorker",
cb: (workerName: string, errorPayload: ErrorPayload, delta: number) => void
cb: (workerName: string, errorPayload: ErrorPayload, delta: number) => void,
): this;

@@ -46,3 +46,3 @@ once(event: "error", cb: (error: Error, queue: string) => void): this;

event: "transferredJob",
cb: (timestamp: number, job: Job<any>) => void
cb: (timestamp: number, job: Job<any>) => void,
): this;

@@ -182,3 +182,3 @@

this.options.leaderLockTimeout,
"NX"
"NX",
);

@@ -194,3 +194,3 @@

leaderKey,
this.options.leaderLockTimeout
this.options.leaderLockTimeout,
);

@@ -226,3 +226,3 @@ return true;

0,
1
1,
);

@@ -248,3 +248,3 @@ if (items.length === 0) return;

this.connection.key("timestamps:" + job),
"delayed:" + timestamp
"delayed:" + timestamp,
);

@@ -265,3 +265,3 @@ return JSON.parse(job);

if (length === 0) {
await this.connection.redis
const response = await this.connection.redis
.multi()

@@ -271,2 +271,8 @@ .del(key)

.exec();
response.forEach((res) => {
if (res[0] !== null) {
throw res[0];
}
});
}

@@ -287,3 +293,3 @@ await this.unwatchIfPossible();

const keys = await this.connection.getKeys(
this.connection.key("worker", "ping", "*")
this.connection.key("worker", "ping", "*"),
);

@@ -293,3 +299,3 @@ const payloads: Array<Payload> = await Promise.all(

return JSON.parse(await this.connection.redis.get(k));
})
}),
);

@@ -299,3 +305,3 @@

const stuckWorkerTimeoutInSeconds = Math.round(
this.options.stuckWorkerTimeout / 1000
this.options.stuckWorkerTimeout / 1000,
);

@@ -331,3 +337,9 @@

private canWatch() {
if (this.connection.redis?.constructor?.name === "RedisMock") return false;
if (
["RedisMock", "_RedisMock"].includes(
this.connection.redis?.constructor?.name,
)
) {
return false;
}
if (typeof this.connection.redis.unwatch !== "function") return false;

@@ -334,0 +346,0 @@ return true;

@@ -46,7 +46,7 @@ import { EventEmitter } from "events";

event: "reEnqueue",
cb: (queue: string, job: ParsedJob, plugin: string) => void
cb: (queue: string, job: ParsedJob, plugin: string) => void,
): this;
on(
event: "success",
cb: (queue: string, job: ParsedJob, result: any, duration: number) => void
cb: (queue: string, job: ParsedJob, result: any, duration: number) => void,
): this;

@@ -59,8 +59,8 @@ on(

failure: Error,
duration: number
) => void
duration: number,
) => void,
): this;
on(
event: "error",
cb: (error: Error, queue: string, job: ParsedJob) => void
cb: (error: Error, queue: string, job: ParsedJob) => void,
): this;

@@ -71,3 +71,3 @@

event: "cleaning_worker",
cb: (worker: Worker, pid: string) => void
cb: (worker: Worker, pid: string) => void,
): this;

@@ -79,15 +79,15 @@ once(event: "poll", cb: (queue: string) => void): this;

event: "reEnqueue",
cb: (queue: string, job: ParsedJob, plugin: string) => void
cb: (queue: string, job: ParsedJob, plugin: string) => void,
): this;
once(
event: "success",
cb: (queue: string, job: ParsedJob, result: any) => void
cb: (queue: string, job: ParsedJob, result: any) => void,
): this;
once(
event: "failure",
cb: (queue: string, job: ParsedJob, failure: any) => void
cb: (queue: string, job: ParsedJob, failure: any) => void,
): this;
once(
event: "error",
cb: (error: Error, queue: string, job: ParsedJob) => void
cb: (error: Error, queue: string, job: ParsedJob) => void,
): this;

@@ -163,3 +163,3 @@

this.connection.key("worker", this.name, this.stringQueues(), "started"),
Math.round(new Date().getTime() / 1000)
Math.round(new Date().getTime() / 1000),
);

@@ -272,3 +272,3 @@ await this.ping();

this.jobs[job.class],
job.args
job.args,
);

@@ -298,3 +298,3 @@ if (toRun === false) {

this.jobs[job.class],
job.args
job.args,
);

@@ -312,3 +312,3 @@ return this.completeJob(true, startedAt);

this.jobs[job.class],
job.args
job.args,
);

@@ -338,3 +338,3 @@ } catch (error) {

throw new Error(
"Worker#performInline can not be used on a started worker"
"Worker#performInline can not be used on a started worker",
);

@@ -357,3 +357,3 @@ }

this.jobs[func],
args
args,
);

@@ -371,3 +371,3 @@ if (toRun === false) {

this.jobs[func],
args
args,
);

@@ -385,3 +385,3 @@ return this.result;

this.jobs[func],
args
args,
);

@@ -409,3 +409,3 @@ } catch (error) {

await this.connection.redis.del(
this.connection.key("worker", this.name, this.stringQueues())
this.connection.key("worker", this.name, this.stringQueues()),
);

@@ -420,3 +420,3 @@ this.job = null;

private async succeed(job: ParsedJob, duration: number) {
await this.connection.redis
const response = await this.connection.redis
.multi()

@@ -426,2 +426,9 @@ .incr(this.connection.key("stat", "processed"))

.exec();
response.forEach((res) => {
if (res[0] !== null) {
throw res[0];
}
});
this.emit("success", this.queue, job, this.result, duration);

@@ -431,3 +438,3 @@ }

private async fail(err: Error, duration: number) {
await this.connection.redis
const response = await this.connection.redis
.multi()

@@ -438,5 +445,12 @@ .incr(this.connection.key("stat", "failed"))

this.connection.key("failed"),
JSON.stringify(this.failurePayload(err, this.job))
JSON.stringify(this.failurePayload(err, this.job)),
)
.exec();
response.forEach((res) => {
if (res[0] !== null) {
throw res[0];
}
});
this.emit("failure", this.queue, this.job, err, duration);

@@ -461,3 +475,3 @@ }

this.name,
this.stringQueues()
this.stringQueues(),
);

@@ -479,3 +493,3 @@

this.queue,
this.name
this.name,
);

@@ -492,3 +506,3 @@ } else {

payload: JSON.parse(encodedJob),
})
}),
);

@@ -507,3 +521,3 @@ }

this.connection.key("workers"),
this.name + ":" + this.stringQueues()
this.name + ":" + this.stringQueues(),
);

@@ -525,3 +539,3 @@ }

this.connection.key("worker", "ping", name),
payload
payload,
);

@@ -537,3 +551,3 @@ }

await this.connection.redis
const response = await this.connection.redis
.multi()

@@ -547,2 +561,8 @@ .srem(this.connection.key("workers"), name + ":" + queues)

.exec();
response.forEach((res) => {
if (res[0] !== null) {
throw res[0];
}
});
}

@@ -563,3 +583,3 @@

const response = await this.connection.redis.smembers(
this.connection.key("queues")
this.connection.key("queues"),
);

@@ -566,0 +586,0 @@ this.queues = response ? response.sort() : [];

@@ -10,3 +10,3 @@ // If a job with the same name, queue, and args is already in the delayed queue(s), do not enqueue it again

this.func,
this.args
this.args,
);

@@ -13,0 +13,0 @@ if (timestamps.length > 0) {

@@ -23,3 +23,3 @@ // If a job with the same name, queue, and args is already running, put this job back in the queue and try later

this.lockTimeout(),
"NX"
"NX",
);

@@ -53,3 +53,3 @@ if (lockedByMe && lockedByMe.toString().toUpperCase() === "OK") {

this.func,
this.args
this.args,
);

@@ -85,3 +85,3 @@ }

this.queue,
flattenedArgs
flattenedArgs,
);

@@ -88,0 +88,0 @@ }

@@ -62,3 +62,3 @@ // If a job with the same name, queue, and args is already in the queue, do not enqueue it again

this.queue,
flattenedArgs
flattenedArgs,
);

@@ -65,0 +65,0 @@ }

@@ -15,3 +15,3 @@ // If a job fails, retry it N times before finally placing it into the failed queue

[key: string]: any;
}
},
) {

@@ -70,3 +70,3 @@ super(worker, func, queue, job, args, options);

this.func,
this.args
this.args,
);

@@ -82,6 +82,6 @@

await this.redis().decr(
this.queueObject.connection.key("stat", "processed")
this.queueObject.connection.key("stat", "processed"),
);
await this.redis().decr(
this.queueObject.connection.key("stat", "processed", this.worker.name)
this.queueObject.connection.key("stat", "processed", this.worker.name),
);

@@ -91,3 +91,3 @@

await this.redis().incr(
this.queueObject.connection.key("stat", "failed", this.worker.name)
this.queueObject.connection.key("stat", "failed", this.worker.name),
);

@@ -180,3 +180,3 @@

this.maxDelay(),
JSON.stringify(data)
JSON.stringify(data),
);

@@ -183,0 +183,0 @@ }

@@ -6,3 +6,3 @@ // inspired by https://github.com/tj/node-blocked

interval: number,
fn: (blocked: boolean, delay: number) => any
fn: (blocked: boolean, delay: number) => any,
) {

@@ -9,0 +9,0 @@ let start = process.hrtime();

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc