Bugfix
This commit is contained in:
parent
9258cc4d1b
commit
ae0d2e1e68
@ -44,6 +44,8 @@ public class EventBusFlux {
|
||||
MessageConsumer<byte[]> subscribe = eventBus.consumer(fluxAddress + ".subscribe");
|
||||
|
||||
subscribe.handler(msg -> {
|
||||
subscribe.unregister(subscribeUnregistered -> {
|
||||
if (subscribeUnregistered.succeeded()) {
|
||||
if (subscriptionsCount.incrementAndGet() > 1) {
|
||||
subscriptionsCount.decrementAndGet();
|
||||
logger.error("Another client tried to connect to the same flux. Rejecting the request.");
|
||||
@ -58,6 +60,8 @@ public class EventBusFlux {
|
||||
MessageConsumer<byte[]> cancel = eventBus.consumer(subscriptionAddress + ".cancel");
|
||||
|
||||
subscriptionReady.<Long>handler(subscriptionReadyMsg -> {
|
||||
subscriptionReady.unregister(subscriptionReadyUnregistered -> {
|
||||
if (subscriptionReadyUnregistered.succeeded()) {
|
||||
var subscription = flux.subscribe(item -> {
|
||||
var request = eventBus.request(subscriptionAddress + ".signal", SignalMessage.<T>onNext(item), signalDeliveryOptions, msg2 -> {
|
||||
if (msg2.failed()) {
|
||||
@ -96,15 +100,10 @@ public class EventBusFlux {
|
||||
if (v.failed()) {
|
||||
logger.error("Failed to unregister dispose", v2.cause());
|
||||
}
|
||||
subscribe.unregister(v3 -> {
|
||||
if (v2.failed()) {
|
||||
logger.error("Failed to unregister subscribe", v3.cause());
|
||||
}
|
||||
msg2.reply(EMPTY);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
cancel.completionHandler(h -> {
|
||||
if (h.succeeded()) {
|
||||
@ -121,6 +120,10 @@ public class EventBusFlux {
|
||||
subscriptionReadyMsg.fail(500, "Failed to register cancel");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
logger.error("Failed to unregister \"subscription ready\"");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
subscriptionReady.completionHandler(srh -> {
|
||||
@ -131,7 +134,10 @@ public class EventBusFlux {
|
||||
msg.fail(500, "Failed to register \"subscription ready\"");
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
logger.error("Failed to unregister subscribe consumer");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
subscribe.completionHandler(h -> {
|
||||
|
@ -263,7 +263,7 @@ public class TDLibRemoteClient implements AutoCloseable {
|
||||
});
|
||||
verticle.start(botAddress, botAddress, false).doOnError(error -> {
|
||||
logger.error("Can't deploy bot \"" + botAddress + "\"", error);
|
||||
}).subscribe(v -> {}, err -> {
|
||||
}).subscribeOn(deploymentScheduler).subscribe(v -> {}, err -> {
|
||||
deploymentHandler.handle(Future.failedFuture(err));
|
||||
}, () -> {
|
||||
deploymentHandler.handle(Future.succeededFuture());
|
||||
|
@ -25,7 +25,7 @@ public class AsyncTdDirectImpl implements AsyncTdDirect {
|
||||
private static final Logger logger = LoggerFactory.getLogger(AsyncTdDirect.class);
|
||||
|
||||
private final One<TelegramClient> td = Sinks.one();
|
||||
private final Scheduler tdScheduler = Schedulers.single();
|
||||
private final Scheduler tdScheduler = Schedulers.newSingle("TdMain");
|
||||
|
||||
private final String botAlias;
|
||||
|
||||
@ -89,7 +89,7 @@ public class AsyncTdDirectImpl implements AsyncTdDirect {
|
||||
closedFromTd.asMono().take(Duration.ofMillis(10)).switchIfEmpty(Mono.fromRunnable(() -> client.send(new Close(),
|
||||
result -> logger.trace("Close result: {}", result),
|
||||
ex -> logger.trace("Error when disposing td client", ex)
|
||||
))).subscribe();
|
||||
))).subscribeOn(tdScheduler).subscribe();
|
||||
});
|
||||
}).subscribeOn(tdScheduler);
|
||||
}
|
||||
|
@ -251,7 +251,7 @@ public class AsyncTdMiddleEventBusServer {
|
||||
System.out.println("<=: end (3)");
|
||||
}
|
||||
this.undeploy(() -> {});
|
||||
});
|
||||
}).subscribeOn(tdSrvPoll);
|
||||
var fluxCodec = new TdResultListMessageCodec();
|
||||
return EventBusFlux.<TdResultList>serve(updatesFlux,
|
||||
cluster.getEventBus(),
|
||||
|
Loading…
Reference in New Issue
Block a user