diff --git a/src/manager.js b/src/manager.js index 45c43082..3d079219 100644 --- a/src/manager.js +++ b/src/manager.js @@ -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; diff --git a/test/subscribeTest.js b/test/subscribeTest.js index 229f5ad1..ccf7f83c 100644 --- a/test/subscribeTest.js +++ b/test/subscribeTest.js @@ -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'); + }); + + }); });