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
181
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 8.2.2 to 8.2.3

6

__tests__/core/queue.ts

@@ -320,2 +320,8 @@ import { Queue, Worker } from "../../src";

test("can determine who the leader is", async () => {
await queue.connection.redis.set(queue.leaderKey(), "the_scheduler");
let leader = await queue.leader();
expect(leader).toBe("the_scheduler");
});
test("can load stats", async () => {

@@ -322,0 +328,0 @@ await queue.connection.redis.set(

@@ -123,2 +123,9 @@ import { Queue, Scheduler, Worker } from "../../src";

test("queues can see who the leader is", async () => {
await scheduler.poll();
const leader = await queue.leader();
expect(leader).toBe(scheduler.options.name);
await scheduler.end();
});
test("will move enqueued jobs when the time comes", async () => {

@@ -125,0 +132,0 @@ await queue.enqueueAt(1000 * 10, specHelper.queue, "someJob", [

2

dist/core/connection.d.ts

@@ -15,3 +15,3 @@ /// <reference types="node" />

end(): void;
key(arg: any, arg2?: any, arg3?: any, arg4?: any): any;
key(arg: any, arg2?: any, arg3?: any, arg4?: any): string;
}

@@ -129,7 +129,15 @@ /// <reference types="node" />

/**
* - stats will be a hash containing details about all the queues in your redis, and how many jobs are in each
* Return the currently elected leader
*/
leader(): Promise<string>;
/**
* - stats will be a hash containing details about all the queues in your redis, and how many jobs are in each, and who the leader is
*/
stats(): Promise<{
[key: string]: any;
}>;
/**
* The redis key which holds the currently elected leader
*/
leaderKey(): string;
}

@@ -401,4 +401,10 @@ "use strict";

/**
* - stats will be a hash containing details about all the queues in your redis, and how many jobs are in each
* Return the currently elected leader
*/
async leader() {
return this.connection.redis.get(this.leaderKey());
}
/**
* - stats will be a hash containing details about all the queues in your redis, and how many jobs are in each, and who the leader is
*/
async stats() {

@@ -418,3 +424,9 @@ const data = {};

}
/**
* The redis key which holds the currently elected leader
*/
leaderKey() {
return this.connection.key("resque_scheduler_leader_lock");
}
}
exports.Queue = Queue;

@@ -37,3 +37,2 @@ /// <reference types="node" />

private pollAgainLater;
private leaderKey;
private tryForLeader;

@@ -40,0 +39,0 @@ private releaseLeaderLock;

@@ -111,9 +111,4 @@ "use strict";

}
leaderKey() {
// TODO: Figure out if more work is needed
// return this.connection.key("resque_scheduler_master_lock");
return this.connection.key("resque_scheduler_leader_lock");
}
async tryForLeader() {
const leaderKey = this.leaderKey();
const leaderKey = this.queue.leaderKey();
if (!this.connection || !this.connection.redis) {

@@ -141,3 +136,3 @@ return;

}
const deleted = await this.connection.redis.del(this.leaderKey());
const deleted = await this.connection.redis.del(this.queue.leaderKey());
this.leader = false;

@@ -144,0 +139,0 @@ return deleted === 1 || deleted.toString() === "true";

@@ -10,4 +10,4 @@ /// <reference types="ioredis" />

argsKey(): string;
retryKey(): any;
failureKey(): any;
retryKey(): string;
failureKey(): string;
maxDelay(): any;

@@ -14,0 +14,0 @@ redis(): import("ioredis").Redis | import("ioredis").Cluster;

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

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

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

"dependencies": {
"ioredis": "^4.19.4"
"ioredis": "^4.22.0"
},
"devDependencies": {
"@types/ioredis": "^4.19.2",
"@types/ioredis": "^4.19.3",
"@types/jest": "^26.0.20",
"@types/node": "^14.14.22",
"ioredis-mock": "^5.2.0",
"@types/node": "^14.14.25",
"ioredis-mock": "^5.2.1",
"jest": "^26.6.3",
"node-schedule": "^2.0.0",
"prettier": "^2.2.1",
"ts-jest": "^26.4.4",
"ts-jest": "^26.5.1",
"ts-node": "^9.1.1",
"typedoc": "^0.20.18",
"typescript": "^4.1.3"
"typedoc": "^0.20.24",
"typescript": "^4.1.5"
},

@@ -46,0 +46,0 @@ "jest": {

@@ -169,3 +169,3 @@ /// <reference path="./../../node_modules/@types/ioredis/index.d.ts" />

key(arg: any, arg2?: any, arg3?: any, arg4?: any) {
key(arg: any, arg2?: any, arg3?: any, arg4?: any): string {
let args;

@@ -172,0 +172,0 @@ args = arguments.length >= 1 ? [].slice.call(arguments, 0) : [];

@@ -554,4 +554,11 @@ import { EventEmitter } from "events";

/**
* - stats will be a hash containing details about all the queues in your redis, and how many jobs are in each
* Return the currently elected leader
*/
async leader() {
return this.connection.redis.get(this.leaderKey());
}
/**
* - stats will be a hash containing details about all the queues in your redis, and how many jobs are in each, and who the leader is
*/
async stats() {

@@ -573,2 +580,9 @@ const data: { [key: string]: any } = {};

}
/**
* The redis key which holds the currently elected leader
*/
leaderKey() {
return this.connection.key("resque_scheduler_leader_lock");
}
}

@@ -175,10 +175,4 @@ // To read notes about the leader locking scheme, check out:

private leaderKey() {
// TODO: Figure out if more work is needed
// return this.connection.key("resque_scheduler_master_lock");
return this.connection.key("resque_scheduler_leader_lock");
}
private async tryForLeader() {
const leaderKey = this.leaderKey();
const leaderKey = this.queue.leaderKey();
if (!this.connection || !this.connection.redis) {

@@ -222,3 +216,3 @@ return;

const deleted = await this.connection.redis.del(this.leaderKey());
const deleted = await this.connection.redis.del(this.queue.leaderKey());
this.leader = false;

@@ -225,0 +219,0 @@ return deleted === 1 || deleted.toString() === "true";

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