Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle infinite streams #62

Merged
merged 1 commit into from
Aug 7, 2023
Merged

Handle infinite streams #62

merged 1 commit into from
Aug 7, 2023

Conversation

ehmicky
Copy link
Collaborator

@ehmicky ehmicky commented Aug 7, 2023

Infinite streams currently hang forever. This PR fixes this.

The reason is because await pipeline() consumes the stream entirely before starting the for loop. Using compose() instead has the same result, except the stream is not consumed.

Consuming the stream entirely would also negates the benefits of the maxBuffer option, making the process crash if the stream is too big. This fixes this too.

@sindresorhus
Copy link
Owner

Thanks for teaching me about compose. I had no idea it existed.

@sindresorhus sindresorhus merged commit cd4f0d5 into sindresorhus:main Aug 7, 2023
3 checks passed
@ehmicky ehmicky deleted the infinite-stream branch August 7, 2023 16:06
This was referenced Aug 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants