Skip to content

Commit

Permalink
test for custom job check interval
Browse files Browse the repository at this point in the history
  • Loading branch information
timgit committed Mar 14, 2017
1 parent 479ac92 commit 6fc942d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class Manager extends EventEmitter {
options.teamSize = options.teamSize || 1;

if('newJobCheckInterval' in options || 'newJobCheckIntervalSeconds' in options)
Attorney.applyNewJobCheckInterval(options);
options = Attorney.applyNewJobCheckInterval(options);
else
options.newJobCheckInterval = self.config.newJobCheckInterval;

Expand Down
19 changes: 19 additions & 0 deletions test/subscribeTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,25 @@ describe('subscribe', function(){
});
});

it('should honor a custom new job check interval', function(finished){
this.timeout(5000);

let startTime = new Date();
const newJobCheckIntervalSeconds = 3;

boss.subscribe('foo', {newJobCheckIntervalSeconds}, (job, done) => {
let elapsed = new Date().getTime() - startTime.getTime();

assert.isAbove((elapsed / 1000), newJobCheckIntervalSeconds);

done()
.then(() => finished());

}).then(() => {
boss.publish('foo');
});

});

});

Expand Down

0 comments on commit 6fc942d

Please sign in to comment.