CombineExt icon indicating copy to clipboard operation
CombineExt copied to clipboard

🆕 Add a 'collect(until:)' operator

Open ferologics opened this issue 3 years ago • 4 comments

Useful for collecting elements when there the element count is unknown or does not fit any time grouping strategy.

ferologics avatar Jun 09 '21 18:06 ferologics

Hey @ferologics, Thanks for the suggestion! I think it's a great idea but there are a few issues with the implementation. Specifically, it is preferable that an operator doesn't use sink internally. Both because it's not a best practice, and because it automatically forces unlimited back pressure demand.

It seems to me it would be more appropriate to either:

  1. Find a way to compose other operators to make this work; or
  2. Build a custom publisher (similar to others in this repo) to be the consumer for the events and the trigger

freak4pc avatar Jul 23 '21 19:07 freak4pc

Hey @ferologics, do you still want to pursue this operator?

freak4pc avatar Aug 28 '21 12:08 freak4pc

Hey @freak4pc, yes! Thank you for the thoughtful response. AFAIK this will require a custom publisher implementation. I will take a look at the implementation of other publishers in the repo and update the code accordingly 🙂

ferologics avatar Aug 28 '21 14:08 ferologics

@freak4pc I updated the PR with alternative implementation that avoids the sink on upstream. I haven't thought of a way to avoid the sink on trigger. Let me know if this is correct 🙌

ferologics avatar Nov 01 '21 09:11 ferologics