better fix for the worker doctype
use the queue's doctype if one is not provided. also adds the option to the readme
This commit is contained in:
@@ -54,10 +54,7 @@ export default class Esqueue extends events.EventEmitter {
|
||||
}
|
||||
|
||||
registerWorker(type, workerFn, opts) {
|
||||
const options = Object.assign({
|
||||
doctype: this.settings.doctype,
|
||||
}, opts);
|
||||
const worker = new Worker(this, type, workerFn, options);
|
||||
const worker = new Worker(this, type, workerFn, opts);
|
||||
this._workers.push(worker);
|
||||
return worker;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ export default class Worker extends events.EventEmitter {
|
||||
this.workerFn = workerFn;
|
||||
this.checkInterval = opts.interval || 1500;
|
||||
this.checkSize = opts.size || 10;
|
||||
this.doctype = opts.doctype || constants.DEFAULT_SETTING_DOCTYPE;
|
||||
this.doctype = opts.doctype || this.queue.doctype || constants.DEFAULT_SETTING_DOCTYPE;
|
||||
|
||||
this.debug = (...msg) => debug(...msg, `id: ${this.id}`);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user