🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

node-resque

Package Overview
Dependencies
Maintainers
2
Versions
182
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

to
0.2.2

35

lib/scheduler.js

@@ -44,3 +44,4 @@ // TODO: Locking like ruby does

self.running = true;
self.interval = setInterval((function() {
self.processing = false;
self.timer = setTimeout((function() {
self.poll();

@@ -53,10 +54,11 @@ }), self.options.timeout);

var self = this;
if(self.running == true){
clearInterval(self.interval);
self.interval = null;
self.running = false;
self.running = false;
if(self.processing == false){
clearTimeout(self.timer);
self.emit('end');
callback();
}else if(self.processing == true){
setTimeout(function(){
self.emit('end');
callback();
}, self.options.timeout * 2) // TODO: Janky, but should ensure that process is complete
self.end(callback);
}, (self.options.timeout / 2));
}

@@ -67,12 +69,19 @@ };

var self = this;
self.processing = true;
clearTimeout(self.timer);
self.emit("poll");
self.nextDelayedTimestamp(function(err, timestamp){
if (!err && timestamp) {
if(!err && timestamp){
self.emit("working_timestamp", timestamp);
self.enqueueDelayedItemsForTimestamp(timestamp, function(err) {
if (err == null) { self.poll(); }
else{
if(typeof callback === "function"){ callback(); }
}
self.poll(callback);
});
}else{
self.processing = false;
if(self.running === true){
self.timer = setTimeout((function() {
self.poll();
}), self.options.timeout);
}
if(typeof callback === "function"){ callback(); }
}

@@ -79,0 +88,0 @@ });

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

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

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

@@ -66,5 +66,4 @@ describe('scheduler', function(){

});
done()
});
});