caolan / caolan/highland

Stream behavior with errors

Open
#583 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
3.4k
Forks
145
PR merge metrics
No merged PRs in 30d

Description

If the call to the `download` function below fails with an error, `stopOnError` will cause the `Promise` to `reject`. Since this is doing `parallel(10)`, will this code wait for the other 9 `download` operations to finish, or will it terminate them right away when it encounters the first error?

How will the behavior be different if I use `mergeWithLimit(10)` instead of `parallel(10)`?

```js
await new Promise((res, rej) => highland(range)
.map(page => highland(download(page)))
.parallel(10)
.stopOnError(rej)
.done(res));
```

Contributor guide

Open the contributing guide

Research direction

Start with the implementations or API documentation for parallel, stopOnError, and mergeWithLimit, then exercise the shown download example with one failing operation. Compare whether other active downloads complete or are cancelled, and document the observable difference between the two stream operators.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.