Open FreeHooks opened 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.
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.
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.
Any ideas on the best way to do this?