NPEs fixed

pull/1705/head
Nikita 7 years ago
parent b8551b8424
commit 9d508ac3a3

@ -747,10 +747,12 @@ public class CommandAsyncService implements CommandAsyncExecutor {
@Override @Override
public void run(Timeout timeout) throws Exception { public void run(Timeout timeout) throws Exception {
MasterSlaveEntry entry = connectionManager.getEntry(connection.getRedisClient()); MasterSlaveEntry entry = connectionManager.getEntry(connection.getRedisClient());
if (entry != null) {
ClientConnectionsEntry ee = entry.getEntry(connection.getRedisClient()); ClientConnectionsEntry ee = entry.getEntry(connection.getRedisClient());
if (ee != null && ee.getNodeType() == NodeType.SLAVE) { if (ee != null && ee.getNodeType() == NodeType.SLAVE) {
ee.trySetupFistFail(); ee.trySetupFistFail();
} }
}
details.getAttemptPromise().tryFailure( details.getAttemptPromise().tryFailure(
new RedisTimeoutException("Redis server response timeout (" + timeoutAmount + " ms) occured for command: " + details.getCommand() new RedisTimeoutException("Redis server response timeout (" + timeoutAmount + " ms) occured for command: " + details.getCommand()
@ -907,13 +909,15 @@ public class CommandAsyncService implements CommandAsyncExecutor {
free(details.getParams()); free(details.getParams());
if (!(future.cause() instanceof RedisTimeoutException)) { if (!(future.cause() instanceof RedisTimeoutException) && details.getConnectionFuture().getNow() != null) {
MasterSlaveEntry entry = connectionManager.getEntry(details.getConnectionFuture().getNow().getRedisClient()); MasterSlaveEntry entry = connectionManager.getEntry(details.getConnectionFuture().getNow().getRedisClient());
if (entry != null) {
ClientConnectionsEntry ee = entry.getEntry(details.getConnectionFuture().getNow().getRedisClient()); ClientConnectionsEntry ee = entry.getEntry(details.getConnectionFuture().getNow().getRedisClient());
if (ee != null && ee.getNodeType() == NodeType.SLAVE) { if (ee != null && ee.getNodeType() == NodeType.SLAVE) {
ee.resetFirstFail(); ee.resetFirstFail();
} }
} }
}
if (future.isSuccess()) { if (future.isSuccess()) {
R res = future.getNow(); R res = future.getNow();

Loading…
Cancel
Save