Faeranne / github-todo

Github webhook to create issues for TODO items in commits.
3 stars 2 forks source link

replace commitDone counter with better loop logic #16

Open FreeHooks opened 10 years ago

Faeranne commented 10 years ago

Any ideas on the best way to do this?

groovecoder commented 10 years ago

Yeah - I was thinking continue or break might be easier. But I didn't trace thru all the logic to see how to re-write the loop with them.

Faeranne commented 10 years ago

So the loop is actually a forEach loop, which calls a request for each element. The problem is that the requests are asynchronous, and I can't call the commitDone callback till every request has returned. I would like to find a better way, but i cant simply continue or break since the entire forEach loop will close before the requests will finish.

Faeranne commented 10 years ago

Best way to fix this will be with an async lib, but this doesn't seem to have a better way to handle it without wrapping in promises.