simplify failed job update error handler

This commit is contained in:
2016-04-28 16:24:28 -07:00
parent 03eca43bbf
commit 379a8f096c

View File

@@ -88,18 +88,7 @@ export default class Job extends events.EventEmitter {
body: { doc }
})
.catch((err) => {
if (err.statusCode === 409) {
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;
});
}
if (err.statusCode === 409) return false;
throw err;
});
}