Re:Show HN: Imba – I have spent 7 years creating a programmi...
by gregoryjjb on Wednesday August 18, 2021 @01:48AM
(#28218100)
await won't block Node from handling other requests but it will block the thread that is awaiting. For example, these will execute one after the other (the "bad way"):
but these execute in parallel, awaiting until both are finished (the "good way"):
[ Parent
| on HN ]
Re:Show HN: Imba – I have spent 7 years creating a programmi...
by hmsimha on Wednesday August 18, 2021 @03:35AM
(#28218571)
Minor clarification, the latter example will only await until both have resolved *or* one rejects. To await the resolution of all promises, you should use the truly gamechanging `Promise.allSettled` , though you will have to transpile it if it's not supported by your target environments.