simplify failed job update error handler
This commit is contained in:
@@ -88,18 +88,7 @@ export default class Job extends events.EventEmitter {
|
|||||||
body: { doc }
|
body: { doc }
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
if (err.statusCode === 409) {
|
if (err.statusCode === 409) return false;
|
||||||
return this.client.get({
|
|
||||||
index: job._index,
|
|
||||||
type: job._type,
|
|
||||||
id: job._id
|
|
||||||
})
|
|
||||||
.then((jobDoc) => {
|
|
||||||
if (jobDoc._source.status === jobStatuses.JOB_STATUS_FAILED) return false;
|
|
||||||
throw err;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
throw err;
|
throw err;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user