node-resque
Advanced tools
Comparing version 9.3.5 to 9.3.6
@@ -1,2 +0,1 @@ | ||
/// <reference types="node" /> | ||
import { EventEmitter } from "events"; | ||
@@ -3,0 +2,0 @@ import { Redis, Cluster } from "ioredis"; |
@@ -1,3 +0,1 @@ | ||
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
import { EventEmitter } from "events"; | ||
@@ -4,0 +2,0 @@ import { Worker } from "./worker"; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.RunPlugin = exports.RunPlugins = void 0; | ||
exports.RunPlugins = RunPlugins; | ||
exports.RunPlugin = RunPlugin; | ||
async function RunPlugins(self, type, func, queue, job, args, pluginCounter) { | ||
@@ -23,3 +24,2 @@ if (!job) | ||
} | ||
exports.RunPlugins = RunPlugins; | ||
async function RunPlugin(self, PluginReference, type, func, queue, job, args) { | ||
@@ -64,2 +64,1 @@ if (!job) | ||
} | ||
exports.RunPlugin = RunPlugin; |
@@ -1,2 +0,1 @@ | ||
/// <reference types="node" /> | ||
import { EventEmitter } from "events"; | ||
@@ -3,0 +2,0 @@ import { ErrorPayload, Jobs } from ".."; |
@@ -1,3 +0,1 @@ | ||
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
import { EventEmitter } from "events"; | ||
@@ -4,0 +2,0 @@ import { ErrorPayload, Job, Jobs } from ".."; |
@@ -110,10 +110,16 @@ "use strict"; | ||
} | ||
const lockedByMe = await this.connection.redis.set(leaderKey, this.options.name, "EX", this.options.leaderLockTimeout, "NX"); | ||
if (lockedByMe && lockedByMe.toUpperCase() === "OK") { | ||
return true; | ||
try { | ||
const lockedByMe = await this.connection.redis.set(leaderKey, this.options.name, "EX", this.options.leaderLockTimeout, "NX"); | ||
if (lockedByMe && lockedByMe.toUpperCase() === "OK") { | ||
return true; | ||
} | ||
const currentLeaderName = await this.connection.redis.get(leaderKey); | ||
if (currentLeaderName === this.options.name) { | ||
await this.connection.redis.expire(leaderKey, this.options.leaderLockTimeout); | ||
return true; | ||
} | ||
} | ||
const currentLeaderName = await this.connection.redis.get(leaderKey); | ||
if (currentLeaderName === this.options.name) { | ||
await this.connection.redis.expire(leaderKey, this.options.leaderLockTimeout); | ||
return true; | ||
catch (error) { | ||
this.emit("error", error); | ||
return false; | ||
} | ||
@@ -120,0 +126,0 @@ return false; |
@@ -1,3 +0,1 @@ | ||
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
import { EventEmitter } from "events"; | ||
@@ -4,0 +2,0 @@ import { Jobs } from ".."; |
"use strict"; | ||
// inspired by https://github.com/tj/node-blocked | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.EventLoopDelay = void 0; | ||
exports.EventLoopDelay = EventLoopDelay; | ||
function EventLoopDelay(limit, interval, fn) { | ||
@@ -24,2 +24,1 @@ let start = process.hrtime(); | ||
} | ||
exports.EventLoopDelay = EventLoopDelay; |
@@ -6,3 +6,3 @@ { | ||
"license": "Apache-2.0", | ||
"version": "9.3.5", | ||
"version": "9.3.6", | ||
"homepage": "http://github.com/actionhero/node-resque", | ||
@@ -34,3 +34,3 @@ "repository": { | ||
"@types/jest": "^29.5.12", | ||
"@types/node": "^20.14.2", | ||
"@types/node": "^22.0.0", | ||
"ioredis-mock": "^8.9.0", | ||
@@ -42,3 +42,3 @@ "jest": "^29.7.0", | ||
"ts-node": "^10.9.2", | ||
"typedoc": "^0.25.13", | ||
"typedoc": "^0.27.5", | ||
"typescript": "^5.4.5" | ||
@@ -45,0 +45,0 @@ }, |
@@ -173,21 +173,26 @@ // To read notes about the leader locking scheme, check out: | ||
const lockedByMe = await this.connection.redis.set( | ||
leaderKey, | ||
this.options.name, | ||
"EX", | ||
this.options.leaderLockTimeout, | ||
"NX", | ||
); | ||
if (lockedByMe && lockedByMe.toUpperCase() === "OK") { | ||
return true; | ||
} | ||
const currentLeaderName = await this.connection.redis.get(leaderKey); | ||
if (currentLeaderName === this.options.name) { | ||
await this.connection.redis.expire( | ||
try { | ||
const lockedByMe = await this.connection.redis.set( | ||
leaderKey, | ||
this.options.name, | ||
"EX", | ||
this.options.leaderLockTimeout, | ||
"NX", | ||
); | ||
return true; | ||
if (lockedByMe && lockedByMe.toUpperCase() === "OK") { | ||
return true; | ||
} | ||
const currentLeaderName = await this.connection.redis.get(leaderKey); | ||
if (currentLeaderName === this.options.name) { | ||
await this.connection.redis.expire( | ||
leaderKey, | ||
this.options.leaderLockTimeout, | ||
); | ||
return true; | ||
} | ||
} catch (error) { | ||
this.emit("error", error); | ||
return false; | ||
} | ||
@@ -194,0 +199,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9126
705135