diff --git a/readme.md b/readme.md index 662389b..3462bcf 100644 --- a/readme.md +++ b/readme.md @@ -114,6 +114,7 @@ Option | Default | Description interval | `1500` | Time, in `ms` to poll for new jobs in the queue. size | `10` | Number of records to return when polling for new jobs. Higher values may result in less Elasticsearch requests, but may also take longer to execute. A bit of tuning based on the number of workers you have my be required here. client | | Alternative elasticsearch client instance, if you need to use one other than what the queue was created with. +doctype | `queue.doctype` | The doctype to use when polling for new jobs. You probably don't want to change this. The worker's `output` can either be the raw output from the job, or on object that specifies the output's content type. diff --git a/src/index.js b/src/index.js index 83400d9..a9c17af 100644 --- a/src/index.js +++ b/src/index.js @@ -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; } diff --git a/src/worker.js b/src/worker.js index b353ed1..e4cb865 100644 --- a/src/worker.js +++ b/src/worker.js @@ -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}`);