ClientConnectionsEntry reverted

pull/3715/head
Nikita Koksharov 4 years ago
parent 0c82ad99d1
commit 12eaac4018

@ -61,7 +61,7 @@ public class ClientConnectionsEntry {
public ClientConnectionsEntry(RedisClient client, int poolMinSize, int poolMaxSize, int subscribePoolMinSize, int subscribePoolMaxSize, public ClientConnectionsEntry(RedisClient client, int poolMinSize, int poolMaxSize, int subscribePoolMinSize, int subscribePoolMaxSize,
ConnectionManager connectionManager, NodeType nodeType) { ConnectionManager connectionManager, NodeType nodeType) {
this.client = client; this.client = client;
this.freeConnectionsCounter = new AsyncSemaphore(20); this.freeConnectionsCounter = new AsyncSemaphore(poolMaxSize);
this.connectionManager = connectionManager; this.connectionManager = connectionManager;
this.nodeType = nodeType; this.nodeType = nodeType;
this.freeSubscribeConnectionsCounter = new AsyncSemaphore(subscribePoolMaxSize); this.freeSubscribeConnectionsCounter = new AsyncSemaphore(subscribePoolMaxSize);
@ -161,8 +161,7 @@ public class ClientConnectionsEntry {
} }
public RedisConnection pollConnection() { public RedisConnection pollConnection() {
return freeConnections.peek(); return freeConnections.poll();
// return freeConnections.poll();
} }
public void releaseConnection(RedisConnection connection) { public void releaseConnection(RedisConnection connection) {
@ -176,10 +175,8 @@ public class ClientConnectionsEntry {
} }
connection.setLastUsageTime(System.nanoTime()); connection.setLastUsageTime(System.nanoTime());
if (freeConnections.isEmpty()) {
freeConnections.add(connection); freeConnections.add(connection);
} }
}
public RFuture<RedisConnection> connect() { public RFuture<RedisConnection> connect() {
RFuture<RedisConnection> future = client.connectAsync(); RFuture<RedisConnection> future = client.connectAsync();

Loading…
Cancel
Save