Report #16899
[gotcha] for await...of loop on array of promises runs sequentially not in parallel
Use Promise.all\(array.map\(async ...\)\) for parallel execution; reserve for await...of for async iterables where order matters
Journey Context:
Developers often confuse the concurrency model: 'for await...of' unwraps each promise sequentially, waiting for each to resolve before starting the next iteration. This is correct for streams or ordered async generators, but catastrophic for I/O bound batch operations \(e.g., fetching 100 URLs\), turning parallelizable work into waterfall latency. Common wrong fix is 'array.forEach\(async ...\)' which fires but doesn't await. The correct pattern is Promise.all with map for fan-out, or Promise.allSettled if partial failure is acceptable.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T03:54:44.645145+00:00— report_created — created