Fixed - TimeoutException is thrown if connectionMinimumIdleSize = 0. #5788

pull/5802/head
Nikita Koksharov 11 months ago
parent 6be51a0b63
commit 0bc90c8108

@ -222,7 +222,11 @@ public class MasterSlaveConnectionManager implements ConnectionManager {
String hostname = hostnameMapper.apply(uri);
CompletableFuture<RedisClient> masterFuture = masterSlaveEntry.setupMasterEntry(uri, hostname);
try {
masterFuture.get(config.getConnectTimeout()*config.getMasterConnectionMinimumIdleSize(), TimeUnit.MILLISECONDS);
if (config.getMasterConnectionMinimumIdleSize() == 0) {
masterFuture.join();
} else {
masterFuture.get(config.getConnectTimeout()*config.getMasterConnectionMinimumIdleSize(), TimeUnit.MILLISECONDS);
}
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
} catch (ExecutionException | TimeoutException e) {
@ -232,7 +236,11 @@ public class MasterSlaveConnectionManager implements ConnectionManager {
if (!config.isSlaveNotUsed()) {
CompletableFuture<Void> fs = masterSlaveEntry.initSlaveBalancer(disconnectedSlaves, hostnameMapper);
try {
fs.get(config.getConnectTimeout()*config.getSlaveConnectionMinimumIdleSize(), TimeUnit.MILLISECONDS);
if (config.getSlaveConnectionMinimumIdleSize() == 0) {
fs.join();
} else {
fs.get(config.getConnectTimeout()*config.getSlaveConnectionMinimumIdleSize(), TimeUnit.MILLISECONDS);
}
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
} catch (ExecutionException | TimeoutException e) {

@ -50,6 +50,15 @@ import static org.awaitility.Awaitility.await;
public class RedissonTest extends RedisDockerTest {
@Test
public void testZeroMinimumIdleSize() {
Config c = redisson.getConfig();
c.useSingleServer().setConnectionMinimumIdleSize(0);
RedissonClient r = Redisson.create(c);
r.shutdown();
}
@Test
public void testVirtualThreads() {
Config c = redisson.getConfig();

Loading…
Cancel
Save