Skip to content

Commit c976537

Browse files
feat: ResourceExhausted isn't pessimize the node
1 parent 54ea1d5 commit c976537

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

core/src/main/java/tech/ydb/core/impl/YdbTransportImpl.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import java.net.URISyntaxException;
55
import java.time.Duration;
66
import java.time.Instant;
7-
import java.util.Arrays;
87
import java.util.Collections;
98
import java.util.List;
109
import java.util.concurrent.CompletableFuture;
@@ -54,7 +53,7 @@ public YdbTransportImpl(GrpcTransportBuilder builder) {
5453

5554
this.channelFactory = builder.getManagedChannelFactory();
5655
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);
5857
this.channelPool = new GrpcChannelPool(channelFactory, scheduler);
5958
this.endpointPool = new EndpointPool(balancingSettings);
6059
this.discovery = new YdbDiscovery(new DiscoveryHandler(), scheduler, database, discoveryTimeout);
@@ -171,7 +170,10 @@ protected GrpcChannel getChannel(GrpcRequestSettings settings) {
171170
@Override
172171
protected void updateChannelStatus(GrpcChannel channel, io.grpc.Status status) {
173172
// 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+
) {
175177
endpointPool.pessimizeEndpoint(channel.getEndpoint());
176178
}
177179
}

0 commit comments

Comments
 (0)