Skip to content

Commit

Permalink
Use retryWhen() in StatsdMeterRegistry (#1946)
Browse files Browse the repository at this point in the history
  • Loading branch information
izeye authored Mar 27, 2020
1 parent 2fbd655 commit 618f5b9
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import reactor.netty.tcp.TcpClient;
import reactor.netty.udp.UdpClient;
import reactor.util.context.Context;
import reactor.util.retry.Retry;

import java.net.PortUnreachableException;
import java.time.Duration;
Expand Down Expand Up @@ -223,7 +224,7 @@ private void prepareUdpClient(Publisher<String> publisher) {
.handle((in, out) -> out
.sendString(publisher)
.neverComplete()
.retry(throwable -> throwable instanceof PortUnreachableException)
.retryWhen(Retry.indefinitely().filter(throwable -> throwable instanceof PortUnreachableException))
)
.connect()
.subscribe(client -> {
Expand Down Expand Up @@ -254,7 +255,7 @@ private void connectAndSubscribe(TcpClient tcpClient) {
}
return Mono.empty();
})
.retryBackoff(Long.MAX_VALUE, Duration.ofSeconds(1), Duration.ofMinutes(1))
.retryWhen(Retry.backoff(Long.MAX_VALUE, Duration.ofSeconds(1)).maxBackoff(Duration.ofMinutes(1)))
.subscribe(client -> {
this.client.replace(client);

Expand Down

0 comments on commit 618f5b9

Please sign in to comment.