My FeedDiscussionsHeadless CMS
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more

How to implement multiple tasks waiting for one task?

Jon's photo
Jon
·Sep 22, 2016

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?