make the size limit configurable

This commit is contained in:
2016-04-28 15:14:44 -07:00
parent 019d9f98a2
commit c32d806886

View File

@@ -21,6 +21,7 @@ export default class Job extends events.EventEmitter {
this.type = type; this.type = type;
this.workerFn = workerFn; this.workerFn = workerFn;
this.checkInterval = opts.interval || 1500; this.checkInterval = opts.interval || 1500;
this.checkSize = opts.size || 10;
this.debug = (...msg) => debug(...msg, `id: ${this.id}`); this.debug = (...msg) => debug(...msg, `id: ${this.id}`);
@@ -166,7 +167,7 @@ export default class Job extends events.EventEmitter {
{ priority: { order: 'asc' }}, { priority: { order: 'asc' }},
{ created_at: { order: 'asc' }} { created_at: { order: 'asc' }}
], ],
size: 10 size: this.checkSize
}; };
this.debug('querying for outstanding jobs'); this.debug('querying for outstanding jobs');