Fixed - MOVED or ASK response from Redis causes "Unable to acquire connection!" error. #3370

pull/3417/head
Nikita Koksharov 4 years ago
parent 36983e6364
commit e70c91b7f9

@ -156,11 +156,11 @@ public class RedisExecutor<V, R> {
checkWriteFuture(writeFuture, attemptPromise, connection); checkWriteFuture(writeFuture, attemptPromise, connection);
} }
}); });
releaseConnection(attemptPromise, connectionFuture);
}); });
attemptPromise.onComplete((r, e) -> { attemptPromise.onComplete((r, e) -> {
releaseConnection(attemptPromise, connectionFuture);
checkAttemptPromise(attemptPromise, connectionFuture); checkAttemptPromise(attemptPromise, connectionFuture);
}); });
} }
@ -624,24 +624,22 @@ public class RedisExecutor<V, R> {
} }
protected void releaseConnection(RPromise<R> attemptPromise, RFuture<RedisConnection> connectionFuture) { protected void releaseConnection(RPromise<R> attemptPromise, RFuture<RedisConnection> connectionFuture) {
attemptPromise.onComplete((res, e) -> { if (!connectionFuture.isSuccess()) {
if (!connectionFuture.isSuccess()) { return;
return; }
}
RedisConnection connection = connectionFuture.getNow(); RedisConnection connection = connectionFuture.getNow();
connectionManager.getShutdownLatch().release(); connectionManager.getShutdownLatch().release();
if (readOnlyMode) { if (readOnlyMode) {
connectionManager.releaseRead(source, connection); connectionManager.releaseRead(source, connection);
} else { } else {
connectionManager.releaseWrite(source, connection); connectionManager.releaseWrite(source, connection);
} }
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("connection released for command {} and params {} from slot {} using connection {}", log.debug("connection released for command {} and params {} from slot {} using connection {}",
command, LogHelper.toString(params), source, connection); command, LogHelper.toString(params), source, connection);
} }
});
} }
public RedisClient getRedisClient() { public RedisClient getRedisClient() {

Loading…
Cancel
Save