[reactor-optional] Fix remaining reactive leakage - #3840
Open
a-TODO-rov wants to merge 1 commit into
Open
Conversation
atakavci
reviewed
Jul 14, 2026
| .doOnNext( | ||
| c -> connection.registerCloseables(closeableResources, clusterWriter, pooledClusterConnectionProvider)) | ||
| .map(it -> (StatefulRedisClusterConnection<K, V>) it).toFuture(); | ||
| return Futures.firstSuccess(Collections.nCopies(getConnectionAttempts(), connectSupplier), |
Collaborator
There was a problem hiding this comment.
i acknowledge this firstSuccess looks fancy,, and function-wise it would be also pretty ok. but i suggest something more easy to follow and maintain. more intuitional..
semantics of it is a bit implicit, i mean, it is not clear whether it suggests eager execution or bind-next approach.
also in term of implementation, personally i tend to avoid recursion if it is not suggested by nature of task.
how about something like Futures.withFallback(Supplier<CompletableFuture> asycnTask, Supplier<CompletableFuture> fallbackTask).
have an overload with errorHandlers may be,, in case its needed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow up of #3697
Note
Medium Risk
Changes how cluster and multi-Sentinel connections are established and retried; behavior is intended to be equivalent but this is on the critical connection path.
Overview
Removes Reactor
Monofrom Sentinel and cluster connection retry paths so those flows use onlyCompletionStage/CompletableFuture.Adds
Futures.firstSuccess, which runs ordered async attempts lazily (next supplier only after the previous fails), returns the first success, and on total failure applies a customerrorHandlerover failures collected in order. Unit tests cover short-circuit on success, fall-through, and ordered aggregation with suppressed causes.RedisClient.connectSentinelAsync(multiple sentinels) drops theMonoonErrorResumechain and a side-channel exception queue; each sentinel attempt is a supplier wired throughfirstSuccess, withRedisConnectionExceptionaggregation matching the prior suppressed-exception behavior.RedisClusterClientcluster and cluster pub/subconnect*AsyncusefirstSuccesswith repeatedconnectSupplierinstances instead of a deferredMonoplus a retry loop; privateconnecthelpers now returnCompletionStageand log failures viawhenCompleteinstead ofdoOnError.Reviewed by Cursor Bugbot for commit f965619. Bugbot is set up for automated code reviews on this repo. Configure here.