-
Notifications
You must be signed in to change notification settings - Fork 147
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
consume push mutates _consumers list. #366
Comments
Any thoughts on fix? Happy to do a PR. |
It's a pretty easy fix. We don't even need to splice before iterating, just save the reference. I already have a PR. |
Side note, support for forking a consumed stream is going away in 3.0.0. That is, you can either This bug only happens when you do a |
Beat me to it 😄 |
Left a note in that PR: you are relying on the same reference in memory when you do that assignment. It could introduce other issues down the line if someone mutates that reference within the loop. |
@vqvu Regarding your earlier comment, I should be fine to do forks only. I end up using highland streams with forking / destroying forks in a dynamic manner. Seems like I can always just fork the original stream since it will just push a new stream on to the _consumers. Why not just have |
We want to force people to explicitly choose a back pressure strategy ( |
Consider the following code:
This code throws the following error:
What is happening is the consumer is being removed at the same time we are iterating a list of consumers to write to. We should either slice (copy) the list of consumers before iterating, or not mutate the consumers list upon getting a nil in
consume
.The text was updated successfully, but these errors were encountered: