Bugfix
This commit is contained in:
parent
4ca148531c
commit
9258cc4d1b
@ -23,6 +23,8 @@ import org.slf4j.LoggerFactory;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Sinks;
|
||||
import reactor.core.publisher.Sinks.Many;
|
||||
import reactor.core.scheduler.Scheduler;
|
||||
import reactor.core.scheduler.Schedulers;
|
||||
|
||||
public class TDLibRemoteClient implements AutoCloseable {
|
||||
|
||||
@ -34,6 +36,7 @@ public class TDLibRemoteClient implements AutoCloseable {
|
||||
private final int port;
|
||||
private final Set<String> membersAddresses;
|
||||
private final Many<TdClusterManager> clusterManager = Sinks.many().replay().latest();
|
||||
private final Scheduler deploymentScheduler = Schedulers.newSingle("TDLib", false);
|
||||
|
||||
public TDLibRemoteClient(SecurityInfo securityInfo, String masterHostname, String netInterface, int port, Set<String> membersAddresses) {
|
||||
this.securityInfo = securityInfo;
|
||||
@ -151,7 +154,7 @@ public class TDLibRemoteClient implements AutoCloseable {
|
||||
})
|
||||
.doOnError(ex -> {
|
||||
logger.error(ex.getLocalizedMessage(), ex);
|
||||
}).subscribe(i -> {}, e -> {
|
||||
}).subscribeOn(deploymentScheduler).subscribe(i -> {}, e -> {
|
||||
logger.error("Remote client error", e);
|
||||
}, () -> startedEventHandler.handle(null));
|
||||
} catch (IOException ex) {
|
||||
@ -292,5 +295,6 @@ public class TDLibRemoteClient implements AutoCloseable {
|
||||
@Override
|
||||
public void close() {
|
||||
clusterManager.asFlux().blockFirst();
|
||||
deploymentScheduler.dispose();
|
||||
}
|
||||
}
|
||||
|
@ -149,6 +149,7 @@ public class AsyncTdMiddleEventBusClient extends AbstractVerticle implements Asy
|
||||
if (msg.succeeded()) {
|
||||
this.listen()
|
||||
.timeout(Duration.ofSeconds(30))
|
||||
.subscribeOn(tdMiddleScheduler)
|
||||
.subscribe(v -> {}, future::fail, future::complete);
|
||||
} else {
|
||||
future.fail(msg.cause());
|
||||
@ -243,7 +244,7 @@ public class AsyncTdMiddleEventBusClient extends AbstractVerticle implements Asy
|
||||
tdClosed.tryEmitNext(true);
|
||||
}
|
||||
}
|
||||
}));
|
||||
})).subscribeOn(tdMiddleScheduler);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -299,6 +300,6 @@ public class AsyncTdMiddleEventBusClient extends AbstractVerticle implements Asy
|
||||
}
|
||||
}).switchIfEmpty(Mono.fromSupplier(() -> {
|
||||
return TdResult.failed(new TdApi.Error(500, "Client is closed or response is empty"));
|
||||
}));
|
||||
})).subscribeOn(tdMiddleScheduler);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user