Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
stream: filter out elements without demand #28467
This will also mean that completion will not be blocked by elements that
One particular use case of that would be a kind of partitioning use case,
The question would be if we can just change the behavior like this or if needs a
Refs #18170 (a long-standing beef I had with filter)
patriknw left a comment
I think it would be an acceptable semantical change, also without providing the alternative. Wouldn't a usage that depended on that be relying on implementation details?
We document it as: backpressures when the given predicate returns true for the element and downstream backpressures
This will also mean that completion will not be blocked by elements that will later be filtered out. One particular use case of that would be a kind of partitioning use case, where you put several streams behind a broadcast and each consumer will filter out elements not handled there. In that case, the broadcast can get head-of-line blocked when one of the consumers currently has no demand but also wouldn't have to handle any elements because they would all be filtered out.