Update AsyncTdMiddleEventBusClient.java

This commit is contained in:
Andrea Cavalli 2021-01-26 12:55:06 +01:00
parent 703e9b1044
commit 9cea2cc5e0

View File

@ -150,10 +150,13 @@ public class AsyncTdMiddleEventBusClient implements AsyncTdMiddle {
// Disable ping on local servers
if (!local) {
Mono
.defer(() -> cluster.getEventBus().<byte[]>rxRequest(botAddress + ".ping",
EMPTY,
deliveryOptionsWithTimeout
).as(MonoUtils::toMono))
.defer(() -> {
logger.trace("Requesting ping...");
return cluster.getEventBus().<byte[]>rxRequest(botAddress + ".ping",
EMPTY,
deliveryOptionsWithTimeout
).as(MonoUtils::toMono);
})
.flatMap(msg -> Mono.fromCallable(msg::body).subscribeOn(Schedulers.boundedElastic()))
.repeatWhen(l -> l.delayElements(Duration.ofSeconds(10)).takeWhile(x -> true))
.takeUntilOther(Mono.firstWithSignal(this.updatesStreamEnd.asMono().doOnTerminate(() -> {