Skip to content

Commit 6ad2df7

Browse files
doc: clarify forEach concurrency and ordering
1 parent 96ee81c commit 6ad2df7

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

‎doc/api/stream.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2326,6 +2326,11 @@ stopped by having passed a `signal` option and aborting the related
23262326
`AbortController` while `for await...of` can be stopped with `break` or
23272327
`return`. In either case the stream will be destroyed.
23282328

2329+
When `concurrency` is greater than `1`, `fn` may be invoked on multiple chunks
2330+
at once, but the calls are still awaited in chunk order (like
2331+
[`readable.map`][]), so a slow `fn` call on an early chunk delays completion
2332+
of the calls on later chunks.
2333+
23292334
This method is different from listening to the [`'data'`][] event in that it
23302335
uses the [`readable`][] event in the underlying machinery and can limit the
23312336
number of concurrent `fn` calls.

0 commit comments

Comments
 (0)