Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions core/src/main/java/tech/ydb/core/impl/YdbTransportImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import java.net.URISyntaxException;
import java.time.Duration;
import java.time.Instant;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.CompletableFuture;
Expand Down Expand Up @@ -54,7 +53,8 @@ public YdbTransportImpl(GrpcTransportBuilder builder) {

this.channelFactory = builder.getManagedChannelFactory();
this.scheduler = builder.getSchedulerFactory().get();
this.callOptions = new AuthCallOptions(scheduler, Arrays.asList(discoveryEndpoint), channelFactory, builder);
this.callOptions = new AuthCallOptions(scheduler, Collections.singletonList(discoveryEndpoint),
channelFactory, builder);
this.channelPool = new GrpcChannelPool(channelFactory, scheduler);
this.endpointPool = new EndpointPool(balancingSettings);
this.discovery = new YdbDiscovery(new DiscoveryHandler(), scheduler, database, discoveryTimeout);
Expand Down Expand Up @@ -171,7 +171,10 @@ protected GrpcChannel getChannel(GrpcRequestSettings settings) {
@Override
protected void updateChannelStatus(GrpcChannel channel, io.grpc.Status status) {
// Usally CANCELLED is received when ClientCall is canceled on client side
if (!status.isOk() && status.getCode() != io.grpc.Status.Code.CANCELLED) {
if (!status.isOk() && status.getCode() != io.grpc.Status.Code.CANCELLED &&
status.getCode() != io.grpc.Status.Code.DEADLINE_EXCEEDED &&
status.getCode() != io.grpc.Status.Code.RESOURCE_EXHAUSTED
) {
endpointPool.pessimizeEndpoint(channel.getEndpoint());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ public class EndpointPoolTest {

@Before
public void setUp() throws IOException {
Mockito.when(socketFactory.createSocket()).thenReturn(socket);
Mockito.doNothing().when(socket).connect(Mockito.any(SocketAddress.class));
mocks = MockitoAnnotations.openMocks(this);
threadLocalStaticMock.when(ThreadLocalRandom::current).thenReturn(random);
socketFactoryStaticMock.when(SocketFactory::getDefault).thenReturn(socketFactory);
Mockito.when(socketFactory.createSocket()).thenReturn(socket);
Mockito.doNothing().when(socket).connect(Mockito.any(SocketAddress.class));
}

@After
Expand Down