Fixed - don't retry non-idempotent operations which were successfully sent. #3850

pull/3872/head
Nikita Koksharov 3 years ago
parent ddd5bf40c9
commit a6953e9e6e

@ -502,4 +502,11 @@ public interface RedisCommands {
RedisStrictCommand<Map<String, String>> INFO_COMMANDSTATS = new RedisStrictCommand<Map<String, String>>("INFO", "COMMANDSTATS", new StringMapDataDecoder());
RedisStrictCommand<Map<String, String>> INFO_CLUSTER = new RedisStrictCommand<Map<String, String>>("INFO", "CLUSTER", new StringMapDataDecoder());
RedisStrictCommand<Map<String, String>> INFO_KEYSPACE = new RedisStrictCommand<Map<String, String>>("INFO", "KEYSPACE", new StringMapDataDecoder());
Set<String> NO_RETRY = new HashSet<>(
Arrays.asList(LPOP.getName(), RPOP.getName(), LPUSH.getName(), RPUSH.getName(),
LPUSHX.getName(), RPUSHX.getName(), GEOADD.getName(), XADD.getName(), APPEND.getName(),
DECR.getName(), "DECRBY", INCR.getName(), INCRBY.getName(), ZINCRBY.getName(),
"HINCRBYFLOAT", "HINCRBY", "INCRBYFLOAT"));
}

@ -289,9 +289,7 @@ public class RedisExecutor<V, R> {
private void scheduleResponseTimeout(RPromise<R> attemptPromise, RedisConnection connection) {
long timeoutTime = responseTimeout;
if (command != null
&& (RedisCommands.BLOCKING_COMMAND_NAMES.contains(command.getName())
|| RedisCommands.BLOCKING_COMMANDS.contains(command))) {
if (command != null && command.isBlockingCommand()) {
Long popTimeout = null;
if (RedisCommands.BLOCKING_COMMANDS.contains(command)) {
for (int i = 0; i < params.length-1; i++) {
@ -343,7 +341,8 @@ public class RedisExecutor<V, R> {
}
protected boolean isResendAllowed(int attempt, int attempts) {
return attempt < attempts;
return attempt < attempts
&& (command == null || (!command.isBlockingCommand() && !RedisCommands.NO_RETRY.contains(command.getName())));
}
private void handleBlockingOperations(RPromise<R> attemptPromise, RedisConnection connection, Long popTimeout) {

Loading…
Cancel
Save