Browse Source
This commit fixes an issue where a Cacheable method which returns a Flux (or multi-value publisher) will be invoked once, but the returned publisher is actually subscribed twice. By using the Reactor `tap` operator, we ensure that we can emit values downstream AND accumulate emitted values into the List with a single subscription. The SignalListener additionally handles scenarios involving cancel, for instance in case of a `take(1)` in the chain. In that case values emitted up until that point will have been stored into the List buffer, so we can still put it in the cache. In case of error, no caching occurs and the internal buffer is cleared. This implementation also protects against competing onComplete/onError signals and cancel signals. Closes gh-32370pull/32403/head
2 changed files with 42 additions and 26 deletions
Loading…
Reference in new issue