append option headers to the index request
This commit is contained in:
12
src/job.js
12
src/job.js
@@ -28,9 +28,7 @@ export default class Job extends events.EventEmitter {
|
|||||||
|
|
||||||
this.debug = (...msg) => debug(...msg, `id: ${this.id}`);
|
this.debug = (...msg) => debug(...msg, `id: ${this.id}`);
|
||||||
|
|
||||||
this.ready = createIndex(this.client, this.index, this.doctype)
|
const indexParams = {
|
||||||
.then(() => {
|
|
||||||
return this.client.index({
|
|
||||||
index: this.index,
|
index: this.index,
|
||||||
type: this.doctype,
|
type: this.doctype,
|
||||||
id: this.id,
|
id: this.id,
|
||||||
@@ -46,7 +44,13 @@ export default class Job extends events.EventEmitter {
|
|||||||
max_attempts: this.maxAttempts,
|
max_attempts: this.maxAttempts,
|
||||||
status: contstants.JOB_STATUS_PENDING,
|
status: contstants.JOB_STATUS_PENDING,
|
||||||
}
|
}
|
||||||
})
|
};
|
||||||
|
|
||||||
|
if (options.headers) indexParams.headers = options.headers;
|
||||||
|
|
||||||
|
this.ready = createIndex(this.client, this.index, this.doctype)
|
||||||
|
.then(() => {
|
||||||
|
return this.client.index(indexParams)
|
||||||
.then((doc) => {
|
.then((doc) => {
|
||||||
this.document = {
|
this.document = {
|
||||||
id: doc._id,
|
id: doc._id,
|
||||||
|
|||||||
Reference in New Issue
Block a user