Last active
August 29, 2015 14:22
-
-
Save buildmaster/da583c759032be971831 to your computer and use it in GitHub Desktop.
This file contains 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
//as you raise the events to run you should save the number of events in process | |
Hoist.data('EventMeta').save({_id:correlationid+'_my_event_count', count:numberOfEventsFired}) |
This file contains 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
//after each event is processed | |
Hoist.lock('module_count'+correlationid).then(function(){ | |
Hoist.data('EventMeta').findById(correlationid+'_my_event_count').then(function(eventMeta){ | |
eventMeta.numberOfEvents --; | |
return Hoist.data('EventMeta').save(eventMeta); | |
}); | |
}).then(function(eventMeta){ | |
if(eventMeta.numberOfEvents<1){ | |
//raise done event; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment