How to implement multiple tasks waiting for one task?
Well, in Node.js or in Clojure...
I ran into a problem — all of the requests are relying on a task on the server. So they have to wait until the task is finished.
I got one solution from my friend — use promise to wrap the task and let others use yield
to wait for that task. And my code is using Koa, it looks strange to create a Promise inside the generator functions.
Do you have any good ideas doing this, in JavaScript(Node 6.x), or in Clojure?