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

Collect operator should support doOnDiscard for Iterable items #1924

Closed
rstoyanchev opened this issue Oct 21, 2019 · 0 comments
Closed

Collect operator should support doOnDiscard for Iterable items #1924

rstoyanchev opened this issue Oct 21, 2019 · 0 comments
Labels
type/enhancement A general enhancement

Comments

@rstoyanchev
Copy link
Contributor

I'm using Flux#collect with a Supplier for a custom List<DataBuffer> to limits the total number of bytes buffered. However doOnDiscard does not work for the items in the List as it does with collectList(). This is understandable for a custom, opaque container, but if the container is a Collection or Iterable then perhaps individual items should be discarded.

simonbasle added a commit that referenced this issue Nov 29, 2019
 - Flux.collect(Supplier, BiConsumer) now detects if the
 container is of type Collection, in which case it discards each element
 in the collection when appropriate
 - the operator also now additionally discard the element T along the
 container when the collector function fails
 - Flux.collect(Collector) now also discards elements in a similar
 fashion to Flux.collect(Supplier, BiConsumer). The accumulator failure
 case and finisher Function failure case are taken into account. The
 discarding of individual elements inside a Collection is applied to
 the intermediate container, not the result of the finisher()

Behavior change: if you extend Operators.MonoSubscriber, keep the
following in mind: `discard(O v)` no longer nulls out the `this.value`
field. Calling methods now need to do that themselves instead.
simonbasle added a commit that referenced this issue Dec 4, 2019
@simonbasle simonbasle added this to the 3.2.14.RELEASE milestone Dec 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants