DATAREDIS-1062 - Disable select dbIndex in case dbIndex is 0.
When shareNativeConnection was set to false and enabled connection pooling before executing each Redis command, select dbIndex command was executed. Selecting the database can be superfluous when the connection already uses the right database index. Original pull request: #496.
This commit is contained in:
committed by
Mark Paluch
parent
74cf6278cb
commit
0fdea07294
@@ -975,10 +975,13 @@ public class LettuceConnection extends AbstractRedisConnection {
|
||||
if (asyncDedicatedConn == null) {
|
||||
|
||||
asyncDedicatedConn = doGetAsyncDedicatedConnection();
|
||||
|
||||
if (asyncDedicatedConn instanceof StatefulRedisConnection) {
|
||||
|
||||
if (asyncDedicatedConn instanceof StatefulRedisConnection && dbIndex > 0) {
|
||||
((StatefulRedisConnection<byte[], byte[]>) asyncDedicatedConn).sync().select(dbIndex);
|
||||
}
|
||||
else if (asyncDedicatedConn instanceof StatefulRedisConnection) {
|
||||
((StatefulRedisConnection<byte[], byte[]>) asyncDedicatedConn).sync();
|
||||
}
|
||||
}
|
||||
|
||||
if (asyncDedicatedConn instanceof StatefulRedisConnection) {
|
||||
|
||||
Reference in New Issue
Block a user