From f0248c6cc0fbf1e5ff59445badd5e54d0850b3de Mon Sep 17 00:00:00 2001 From: Igor Artamonov Date: Sun, 8 Sep 2019 23:54:20 -0400 Subject: [PATCH] problem: grpc upstream timeouts solution: tune connection settings --- .../io/emeraldpay/dshackle/upstream/grpc/GrpcUpstreams.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/grpc/GrpcUpstreams.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/grpc/GrpcUpstreams.kt index 87a1b600..85c875be 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/grpc/GrpcUpstreams.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/grpc/GrpcUpstreams.kt @@ -57,6 +57,8 @@ class GrpcUpstreams( val channel: ManagedChannelBuilder<*> = if (auth != null && StringUtils.isNotEmpty(auth.ca)) { NettyChannelBuilder.forAddress(host, port) .useTransportSecurity() + .enableRetry() + .maxRetryAttempts(3) .sslContext(withTls(auth)) } else { log.warn("Using insecure connection to $host:$port") @@ -67,7 +69,7 @@ class GrpcUpstreams( val client = ReactorBlockchainGrpc.newReactorStub(channel.build()) this.client = client var i = 0 - val grpcExecutor = Executors.newFixedThreadPool(32) { r -> Thread(r, "grpc-up-$id-${i++}") }; + val grpcExecutor = Executors.newFixedThreadPool(64) { r -> Thread(r, "grpc-up-$id-${i++}") }; this.grpcTransport = EmeraldGrpcTransport.newBuilder() .forChannel(client.channel) .setObjectMapper(objectMapper)