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

node-resque

Package Overview
Dependencies
Maintainers
2
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 0.5.1 to 0.5.2

6

lib/plugins/queueLock.js

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

redisTimeout = parseInt(redisTimeout);
if(now > redisTimeout){
callback(null. true);
}else{
callback(null, false);
}
callback(null, now > redisTimeout);
});

@@ -43,0 +39,0 @@ });

5

lib/queue.js

@@ -66,4 +66,7 @@ var util = require('util');

var rTimestamp = Math.round(timestamp / 1000); // assume timestamp is in ms
self.connection.redis.rpush(self.connection.key("delayed:" + rTimestamp), item, function(){
// enqueue the encoded job into a list per timestmp to be popped and workered later
self.connection.redis.rpush(self.connection.key("delayed:" + rTimestamp), item, function(){
// save the job + args into a set so that it can be checked by plugins
self.connection.redis.sadd(self.connection.key("timestamps:" + item), self.connection.key("delayed:" + rTimestamp), function(){
// and the timestamp in question to a zset to the scheduler will know which timestamps have data to work
self.connection.redis.zadd(self.connection.key('delayed_queue_schedule'), rTimestamp, rTimestamp, function(){

@@ -70,0 +73,0 @@ if(typeof callback == "function"){ callback(); }

@@ -129,2 +129,3 @@ var os = require("os");

var d = domain.create();
self.job = job;
d.on('error', function(err){

@@ -140,3 +141,2 @@ self.completeJob(err, null, true, callback);

if(cb != null) {
self.job = job;
var returnCounter = 0; // a state counter to prevent multiple returns from poor jobs or plugins

@@ -143,0 +143,0 @@ var callbackError = new Error('refusing to continue with job, multiple callbacks detected');

@@ -5,3 +5,3 @@ {

"description": "an opinionated implementation of resque in node",
"version": "0.5.1",
"version": "0.5.2",
"homepage": "http://github.com/taskrabbit/node-resque",

@@ -8,0 +8,0 @@ "repository": {

@@ -105,2 +105,11 @@ var specHelper = require(__dirname + "/../_specHelper.js").specHelper;

it('will not match previously scheduled jobs with differnt args', function(done){
queue.enqueueAt(10000, specHelper.queue, 'someJob', [1,2,3], function(){
queue.scheduledAt(specHelper.queue, 'someJob', [3,2,1], function(err, timestamps){
timestamps.length.should.equal(0);
done();
});
});
});
it('can deleted an enqued job', function(done){

@@ -107,0 +116,0 @@ queue.enqueue(specHelper.queue, 'someJob', [1,2,3], function(){

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