Use a single worker pool
This commit is contained in:
parent
81efd6dc8a
commit
bc40e2b9e6
@ -1,6 +1,5 @@
|
||||
package it.tdlight.tdlibsession.remoteclient;
|
||||
|
||||
import io.vertx.core.DeploymentOptions;
|
||||
import io.vertx.core.Handler;
|
||||
import io.vertx.core.json.JsonObject;
|
||||
import io.vertx.core.net.JksOptions;
|
||||
@ -8,6 +7,7 @@ import it.tdlight.common.Init;
|
||||
import it.tdlight.common.utils.CantLoadLibrary;
|
||||
import it.tdlight.tdlibsession.td.middle.TdClusterManager;
|
||||
import it.tdlight.tdlibsession.td.middle.server.AsyncTdMiddleEventBusServer;
|
||||
import it.tdlight.utils.MonoUtils;
|
||||
import java.io.IOException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.nio.file.FileAlreadyExistsException;
|
||||
@ -21,7 +21,6 @@ import java.util.stream.Collectors;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import it.tdlight.utils.MonoUtils;
|
||||
import reactor.core.publisher.Mono;
|
||||
import reactor.core.publisher.ReplayProcessor;
|
||||
|
||||
@ -133,7 +132,7 @@ public class TDLibRemoteClient implements AutoCloseable {
|
||||
.getKey()
|
||||
.getVertx()
|
||||
.deployVerticle(new AsyncTdMiddleEventBusServer(entry.getKey()),
|
||||
new DeploymentOptions().setConfig(new JsonObject()
|
||||
entry.getKey().newDeploymentOpts().setConfig(new JsonObject()
|
||||
.put("botAddress", entry.getValue())
|
||||
.put("botAlias", entry.getValue())
|
||||
.put("local", false)),
|
||||
|
@ -8,6 +8,7 @@ import com.hazelcast.config.MaxSizeConfig;
|
||||
import com.hazelcast.config.MaxSizeConfig.MaxSizePolicy;
|
||||
import com.hazelcast.config.MergePolicyConfig;
|
||||
import com.hazelcast.config.SemaphoreConfig;
|
||||
import io.vertx.core.DeploymentOptions;
|
||||
import io.vertx.core.Handler;
|
||||
import io.vertx.core.Vertx;
|
||||
import io.vertx.core.VertxOptions;
|
||||
@ -224,4 +225,8 @@ public class TdClusterManager {
|
||||
return eb.consumer(address, handler);
|
||||
}
|
||||
}
|
||||
|
||||
public DeploymentOptions newDeploymentOpts() {
|
||||
return new DeploymentOptions().setWorkerPoolName("td-main-pool");
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,6 @@ import io.vertx.circuitbreaker.CircuitBreaker;
|
||||
import io.vertx.circuitbreaker.CircuitBreakerOptions;
|
||||
import io.vertx.core.AbstractVerticle;
|
||||
import io.vertx.core.AsyncResult;
|
||||
import io.vertx.core.DeploymentOptions;
|
||||
import io.vertx.core.Promise;
|
||||
import io.vertx.core.eventbus.DeliveryOptions;
|
||||
import io.vertx.core.eventbus.Message;
|
||||
@ -76,7 +75,7 @@ public class AsyncTdMiddleEventBusClient extends AbstractVerticle implements Asy
|
||||
public static Mono<AsyncTdMiddleEventBusClient> getAndDeployInstance(TdClusterManager clusterManager, String botAlias, String botAddress, boolean local) throws InitializationException {
|
||||
try {
|
||||
var instance = new AsyncTdMiddleEventBusClient(clusterManager);
|
||||
var options = new DeploymentOptions().setConfig(new JsonObject()
|
||||
var options = clusterManager.newDeploymentOpts().setConfig(new JsonObject()
|
||||
.put("botAddress", botAddress)
|
||||
.put("botAlias", botAlias)
|
||||
.put("local", local));
|
||||
|
@ -3,7 +3,6 @@ package it.tdlight.tdlibsession.td.middle.direct;
|
||||
import static it.tdlight.tdlibsession.td.middle.server.AsyncTdMiddleEventBusServer.WAIT_DURATION;
|
||||
|
||||
import io.vertx.core.AbstractVerticle;
|
||||
import io.vertx.core.DeploymentOptions;
|
||||
import io.vertx.core.Promise;
|
||||
import io.vertx.core.json.JsonObject;
|
||||
import it.tdlight.jni.TdApi.Function;
|
||||
@ -39,7 +38,7 @@ public class AsyncTdMiddleDirect extends AbstractVerticle implements AsyncTdMidd
|
||||
String botAddress) throws InitializationException {
|
||||
try {
|
||||
var instance = new AsyncTdMiddleDirect();
|
||||
var options = new DeploymentOptions().setConfig(new JsonObject()
|
||||
var options = clusterManager.newDeploymentOpts().setConfig(new JsonObject()
|
||||
.put("botAlias", botAlias)
|
||||
.put("botAddress", botAddress));
|
||||
return MonoUtils.<String>executeAsFuture(promise -> {
|
||||
|
@ -40,7 +40,7 @@ public class AsyncTdMiddleLocal implements AsyncTdMiddle {
|
||||
masterClusterManager
|
||||
.getVertx()
|
||||
.deployVerticle(srv,
|
||||
new DeploymentOptions().setConfig(new JsonObject().put("botAddress", botAddress).put("botAlias", botAlias).put("local", true)),
|
||||
masterClusterManager.newDeploymentOpts().setConfig(new JsonObject().put("botAddress", botAddress).put("botAlias", botAlias).put("local", true)),
|
||||
MonoUtils.toHandler(sink)
|
||||
);
|
||||
}).onErrorMap(InitializationException::new).flatMap(_x -> {
|
||||
|
Loading…
x
Reference in New Issue
Block a user