Skip to content

Commit cb9e46f

Browse files
committed
makes usage of retry only in case whenFactory is set up
Signed-off-by: Oleh Dokuka <[email protected]>
1 parent 289b1e7 commit cb9e46f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

rsocket-core/src/main/java/io/rsocket/RSocketFactory.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,6 @@ public static class ClientRSocketFactory implements ClientTransportAcceptor {
101101

102102
private static final BiConsumer<RSocket, Invalidatable> INVALIDATE_FUNCTION =
103103
(r, i) -> r.onClose().subscribe(null, null, i::invalidate);
104-
private static final Function<Flux<Throwable>, ? extends Publisher<?>> FAIL_WHEN_FACTORY =
105-
f -> f.concatMap(Mono::error);
106104

107105
private SocketAcceptor acceptor = (setup, sendingSocket) -> Mono.just(new AbstractRSocket() {});
108106

@@ -135,7 +133,7 @@ public static class ClientRSocketFactory implements ClientTransportAcceptor {
135133
private boolean leaseEnabled;
136134
private Supplier<Leases<?>> leasesSupplier = Leases::new;
137135
private boolean reconnectEnabled;
138-
private Function<Flux<Throwable>, ? extends Publisher<?>> whenFactory = FAIL_WHEN_FACTORY;
136+
private Function<Flux<Throwable>, ? extends Publisher<?>> whenFactory;
139137

140138
private ByteBufAllocator allocator = ByteBufAllocator.DEFAULT;
141139

@@ -531,7 +529,9 @@ public Mono<RSocket> start() {
531529
source -> {
532530
if (reconnectEnabled) {
533531
return new ReconnectMono<>(
534-
source.retryWhen(whenFactory), Disposable::dispose, INVALIDATE_FUNCTION);
532+
whenFactory == null ? source : source.retryWhen(whenFactory),
533+
Disposable::dispose,
534+
INVALIDATE_FUNCTION);
535535
} else {
536536
return source;
537537
}

0 commit comments

Comments
 (0)