caolan / caolan/highland

stream consume push within a promise hang fails

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

Description

I use `consume` as described below:

``` js
source.consume(function(err, res, push, next) {
getPromise().then(function() {
push(null, res);
next(self.linkPageStream(1));
});
});
```

See I call `push` and `next` within a promise. But this hangs fails.

See this [gist](https://gist.github.com/eguneys/cc11fb73f7f02266e014) for a sample case to reproduce.

Edit: I think this happens because, when building a stream generator it says:

> You can also redirect a generator Stream by passing a new source Stream to read from to next. For example: next(other_stream) - then any subsequent calls will be made to the new source.

Note that I use the same notation within `consume`, like `next(self.linkPageStream(1))`. Probably you can't redirect to a new stream within `consume`. Is that true, and why not?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.