When do you use Promise.all, allSettled and a limited pool of workers?
Answer out loud or in your head first, then compare.
Answer
Promise.all is useful when I need the complete set of results and one error should mean the whole thing failed. Promise.allSettled collects the success or error of each operation separately. It suits, for example, independent sources where some may be temporarily unavailable.
Neither tool limits the number of requests started. If I first call fetch for a thousand URLs, the work has already begun. To have at most three active reads, I need a pool: when one finishes, a worker takes the next item. Rejection of all doesn't automatically cancel the other operations. A limit on concurrent operations is also different from a limit on requests per second.
Why it matters: A natural live-coding topic, and relevant to a skill that fetches many sources.
Possible follow-ups: How do you keep results in order? What happens after a task is cancelled?
How did it go? Be honest — “Not yet” puts the question on your review list.
Start with
- B-P01 · What is Node.js, and how is it different from JavaScript in the browser? — JavaScript, TypeScript and Node.js
- B-P04 · What is a Promise? — JavaScript, TypeScript and Node.js
- B-P10 · What does TypeScript give you, and what doesn't it? — JavaScript, TypeScript and Node.js
Related questions
- Promise.all, allSettled and a concurrency limit — JavaScript, TypeScript and Node.js
Practise in code
- At most three active operations — runs tests in your browser
Further reading
- Node.js: The Event Loop(opens in a new tab)Docs; accessed 22.10.2026. Event loop phases, timers and differences between Node/libuv versions.