add new events

one for when the search is completed, and one for when the job poller is ready
This commit is contained in:
2017-05-23 20:11:07 -07:00
parent 128905cdb4
commit 6bdf7163b6
2 changed files with 6 additions and 0 deletions

View File

@@ -270,6 +270,7 @@ export default class Worker extends events.EventEmitter {
} , this.checkInterval);
this._poller.running = true;
this.emit(constants.EVENT_WORKER_JOB_POLLING_READY);
}
_stopJobPolling() {
@@ -349,7 +350,10 @@ export default class Worker extends events.EventEmitter {
})
.then((results) => {
const jobs = results.hits.hits;
this.debug(`${jobs.length} outstanding jobs returned`);
this.emit(constants.EVENT_WORKER_JOB_SEARCH_COMPLETE, jobs);
return jobs;
})
.catch((err) => {