Skip to content

Commit

Permalink
Fix lint errors (#656)
Browse files Browse the repository at this point in the history
  • Loading branch information
udleinati authored and manast committed Aug 13, 2017
1 parent 51b1347 commit 1b6b08d
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 43 deletions.
5 changes: 2 additions & 3 deletions lib/commands/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ module.exports = (function (){
function loadScripts(dir) {
return fs.readdirAsync(dir).filter(function (file){
return path.extname(file) === '.lua';
})
.map(function (file) {
}).map(function (file) {
var longName = path.basename(file, '.lua');
var name = longName.split('-')[0];
var numberOfKeys = parseInt(longName.split('-')[1]);
Expand All @@ -50,4 +49,4 @@ function loadScripts(dir) {
};
});
});
}
}
11 changes: 6 additions & 5 deletions lib/job.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,11 +239,12 @@ Job.prototype.promote = function(){
keys.length,
keys[0],
keys[1],
jobId).then(function(result){
if(result === -1){
throw new Error('Job ' + jobId + ' is not in a delayed state');
}
});
jobId
).then(function(result){
if(result === -1){
throw new Error('Job ' + jobId + ' is not in a delayed state');
}
});
};

/**
Expand Down
4 changes: 2 additions & 2 deletions lib/queue.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,8 @@ var Queue = function Queue(name, url, opts){

function redisClientGetter(queue, options, initCallback) {
var createClient = _.isFunction(options.createClient)
? options.createClient
: function(type, config) { return new redis(config); };
? options.createClient
: function(type, config) { return new redis(config); };

var connections = {};

Expand Down
31 changes: 16 additions & 15 deletions lib/repeatable.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,21 +61,22 @@ module.exports = function(Queue){
end = end || -1;
return (asc ?
this.client.zrange(key, start, end, 'WITHSCORES') :
this.client.zrevrange(key, start, end, 'WITHSCORES')).then(function(result){
var jobs = [];
for(var i=0; i<result.length; i+=2){
var data = result[i].split(':');
jobs.push({
name: data[0],
id: data[1] || null,
endDate: parseInt(data[2]) || null,
tz: data[3] || null,
cron: data[4],
next: parseInt(result[i+1])
});
}
return jobs;
});
this.client.zrevrange(key, start, end, 'WITHSCORES')
).then(function(result){
var jobs = [];
for(var i=0; i<result.length; i+=2){
var data = result[i].split(':');
jobs.push({
name: data[0],
id: data[1] || null,
endDate: parseInt(data[2]) || null,
tz: data[3] || null,
cron: data[4],
next: parseInt(result[i+1])
});
}
return jobs;
});
};

Queue.prototype.getRepeatableCount = function(){
Expand Down
2 changes: 1 addition & 1 deletion test/cluster_worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ queue.process(1, function(job, jobDone) {

process.on('disconnect', function () {
queue.close().then(function () {
// process.exit(0);
// process.exit(0);
}).catch(function (err) {
console.error(err);
// process.exit(-1);
Expand Down
35 changes: 18 additions & 17 deletions test/test_queue.js
Original file line number Diff line number Diff line change
Expand Up @@ -1528,24 +1528,25 @@ describe('Queue', function () {
queue.add({ order: 2 }, { delay: 300 }),
queue.add({ order: 4 }, { delay: 500 }),
queue.add({ order: 1 }, { delay: 200 }),
queue.add({ order: 3 }, { delay: 400 })).then(function () {
//
// Start processing so that jobs get into the delay set.
//
queue.process(fn);
}).delay(20).then(function () {
/*
//We simulate a restart
console.log('RESTART');
return queue.close().then(function () {
console.log('CLOSED');
return Promise.delay(100).then(function () {
queue = new Queue(QUEUE_NAME);
queue.process(fn);
});
queue.add({ order: 3 }, { delay: 400 })
).then(function () {
//
// Start processing so that jobs get into the delay set.
//
queue.process(fn);
}).delay(20).then(function () {
/*
//We simulate a restart
console.log('RESTART');
return queue.close().then(function () {
console.log('CLOSED');
return Promise.delay(100).then(function () {
queue = new Queue(QUEUE_NAME);
queue.process(fn);
});
*/
});
*/
});
});

it('should process delayed jobs with exact same timestamps in correct order (FIFO)', function (done) {
Expand Down Expand Up @@ -2458,4 +2459,4 @@ describe('Queue', function () {
});
});
});
});
});

0 comments on commit 1b6b08d

Please sign in to comment.