print timeout amount in error

pull/337/head
Nikita 9 years ago
parent 4729762eaa
commit 088686d002

@ -418,28 +418,27 @@ public class CommandAsyncService implements CommandAsyncExecutor {
"Can't write command: " + command + ", params: " + params + " to channel: " + future.channel(), future.cause())); "Can't write command: " + command + ", params: " + params + " to channel: " + future.channel(), future.cause()));
} else { } else {
timeoutRef.get().cancel(); timeoutRef.get().cancel();
int timeoutTime = connectionManager.getConfig().getTimeout();
if (command.getName().equals(RedisCommands.BLPOP_VALUE.getName())) {
Integer blPopTimeout = Integer.valueOf(params[params.length - 1].toString());
if (blPopTimeout == 0) {
return;
}
timeoutTime += blPopTimeout*1000;
}
final int timeoutAmount = timeoutTime;
TimerTask timeoutTask = new TimerTask() { TimerTask timeoutTask = new TimerTask() {
@Override @Override
public void run(Timeout timeout) throws Exception { public void run(Timeout timeout) throws Exception {
attemptPromise.tryFailure( attemptPromise.tryFailure(
new RedisTimeoutException("Redis server response timeout for command: " + command new RedisTimeoutException("Redis server response timeout (" + timeoutAmount + " ms) for command: " + command
+ " with params: " + Arrays.toString(params) + " channel: " + connection.getChannel())); + " with params: " + Arrays.toString(params) + " channel: " + connection.getChannel()));
} }
}; };
int timeoutTime = connectionManager.getConfig().getTimeout(); Timeout timeout = connectionManager.newTimeout(timeoutTask, timeoutTime, TimeUnit.MILLISECONDS);
if (command.getName().equals(RedisCommands.BLPOP_VALUE.getName())) { timeoutRef.set(timeout);
Integer blPopTimeout = Integer.valueOf(params[params.length - 1].toString());
if (blPopTimeout == 0) {
timeoutTime = -1;
} else {
timeoutTime += blPopTimeout*1000;
}
}
if (timeoutTime != -1) {
Timeout timeout = connectionManager.newTimeout(timeoutTask, timeoutTime, TimeUnit.MILLISECONDS);
timeoutRef.set(timeout);
}
} }
} }
}); });

Loading…
Cancel
Save