From e8c6d0079140641e75ce6603b30b08ba53642ff2 Mon Sep 17 00:00:00 2001 From: Nikita Koksharov Date: Mon, 20 Sep 2021 12:31:37 +0300 Subject: [PATCH] Use connection pool optimization only if size less than 10 connections. --- .../main/java/org/redisson/command/RedisExecutor.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/redisson/src/main/java/org/redisson/command/RedisExecutor.java b/redisson/src/main/java/org/redisson/command/RedisExecutor.java index c9f3b53a8..7a8a4c928 100644 --- a/redisson/src/main/java/org/redisson/command/RedisExecutor.java +++ b/redisson/src/main/java/org/redisson/command/RedisExecutor.java @@ -505,7 +505,10 @@ public class RedisExecutor { connectionType, command, LogHelper.toString(params), source, connection.getRedisClient().getAddr(), connection); } writeFuture = connection.send(new CommandData<>(attemptPromise, codec, command, params)); - release(connection); + + if (connectionManager.getConfig().getMasterConnectionPoolSize() < 10) { + release(connection); + } } } @@ -516,7 +519,11 @@ public class RedisExecutor { RedisConnection connection = connectionFuture.getNow(); connectionManager.getShutdownLatch().release(); - if (source.getRedirect() == Redirect.ASK || getClass() != RedisExecutor.class) { + if (connectionManager.getConfig().getMasterConnectionPoolSize() < 10) { + if (source.getRedirect() == Redirect.ASK || getClass() != RedisExecutor.class) { + release(connection); + } + } else { release(connection); }