emit on worker completion

with test
This commit is contained in:
2016-07-08 17:14:07 -07:00
parent 362469f541
commit 057bd26b74
3 changed files with 23 additions and 0 deletions

View File

@@ -195,6 +195,7 @@ export default class Job extends events.EventEmitter {
version: job._version,
body: { doc }
})
.then(() => this.emit(constants.EVENT_WORKER_COMPLETE, Object.assign(emitJob, { output: docOutput })))
.catch((err) => {
if (err.statusCode === 409) return false;
this.debug(`Failure saving job output ${job._id}`, err);