Skip to content

Commit 87eb1dd

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

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

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

Lines changed: 6 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,8 @@ 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),
57+
channelFactory, builder);
5858
this.channelPool = new GrpcChannelPool(channelFactory, scheduler);
5959
this.endpointPool = new EndpointPool(balancingSettings);
6060
this.discovery = new YdbDiscovery(new DiscoveryHandler(), scheduler, database, discoveryTimeout);
@@ -171,7 +171,10 @@ protected GrpcChannel getChannel(GrpcRequestSettings settings) {
171171
@Override
172172
protected void updateChannelStatus(GrpcChannel channel, io.grpc.Status status) {
173173
// Usally CANCELLED is received when ClientCall is canceled on client side
174-
if (!status.isOk() && status.getCode() != io.grpc.Status.Code.CANCELLED) {
174+
if (!status.isOk() && status.getCode() != io.grpc.Status.Code.CANCELLED &&
175+
status.getCode() != io.grpc.Status.Code.DEADLINE_EXCEEDED &&
176+
status.getCode() != io.grpc.Status.Code.RESOURCE_EXHAUSTED
177+
) {
175178
endpointPool.pessimizeEndpoint(channel.getEndpoint());
176179
}
177180
}

0 commit comments

Comments
 (0)