|
4 | 4 | import java.net.URISyntaxException; |
5 | 5 | import java.time.Duration; |
6 | 6 | import java.time.Instant; |
7 | | -import java.util.Arrays; |
8 | 7 | import java.util.Collections; |
9 | 8 | import java.util.List; |
10 | 9 | import java.util.concurrent.CompletableFuture; |
@@ -54,7 +53,7 @@ public YdbTransportImpl(GrpcTransportBuilder builder) { |
54 | 53 |
|
55 | 54 | this.channelFactory = builder.getManagedChannelFactory(); |
56 | 55 | this.scheduler = builder.getSchedulerFactory().get(); |
57 | | - this.callOptions = new AuthCallOptions(scheduler, Arrays.asList(discoveryEndpoint), channelFactory, builder); |
| 56 | + this.callOptions = new AuthCallOptions(scheduler, Collections.singletonList(discoveryEndpoint), channelFactory, builder); |
58 | 57 | this.channelPool = new GrpcChannelPool(channelFactory, scheduler); |
59 | 58 | this.endpointPool = new EndpointPool(balancingSettings); |
60 | 59 | this.discovery = new YdbDiscovery(new DiscoveryHandler(), scheduler, database, discoveryTimeout); |
@@ -171,7 +170,10 @@ protected GrpcChannel getChannel(GrpcRequestSettings settings) { |
171 | 170 | @Override |
172 | 171 | protected void updateChannelStatus(GrpcChannel channel, io.grpc.Status status) { |
173 | 172 | // Usally CANCELLED is received when ClientCall is canceled on client side |
174 | | - if (!status.isOk() && status.getCode() != io.grpc.Status.Code.CANCELLED) { |
| 173 | + if (!status.isOk() && status.getCode() != io.grpc.Status.Code.CANCELLED && |
| 174 | + status.getCode() != io.grpc.Status.Code.DEADLINE_EXCEEDED && |
| 175 | + status.getCode() != io.grpc.Status.Code.RESOURCE_EXHAUSTED |
| 176 | + ) { |
175 | 177 | endpointPool.pessimizeEndpoint(channel.getEndpoint()); |
176 | 178 | } |
177 | 179 | } |
|
0 commit comments