Created
February 23, 2015 00:34
-
-
Save dbousamra/a10f313db151c72467c4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| return this.repository.getEventById(msg.getReferenceIdentifier()).then((eventO: m.Option<domain.core.Event>) => { | |
| if (!eventO.isDefined) { | |
| this.logger.error("%s - Could not find event.", event.id) | |
| return Promise.resolve(new message.ImageIntelligenceRequeueRequest(event, false)) | |
| } | |
| var event = eventO.get(); | |
| // If it does contain a person, handle person | |
| if (msg.doesEventContainPerson) { | |
| this.logger.info("%s - Received callback from ImageIntelligence with persons detected.", event.id) | |
| return this.handlePersonFoundResponse(msg, event).then(function() { | |
| return Promise.resolve(new message.ImageIntelligenceRequeueRequest(event, false)) | |
| }) | |
| } | |
| // If it does not contain a person, and event has not ended, requeue for further analysis. | |
| if (!msg.doesEventContainPerson() && !event.hasEnded) { | |
| this.logger.info("%s - Received callback from ImageIntelligence with no persons detected but event is not finished. Requeuing", event.id) | |
| return Promise.resolve(new message.ImageIntelligenceRequeueRequest(event, true)) | |
| } | |
| // If it does not contain a person, and event has ended, don't requeue | |
| this.logger.info("%s - Received callback from ImageIntelligence with no persons detected, and event has finished. Not requeuing", event.id) | |
| return Promise.resolve(new message.ImageIntelligenceRequeueRequest(event, false)) | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment