redirection loop with MOVED handling added. #1397

pull/1423/head
Nikita 7 years ago
parent 2b2aace839
commit 6247ba52c6

@ -808,10 +808,16 @@ public class CommandAsyncService implements CommandAsyncExecutor {
return;
}
try {
details.removeMainPromiseListener();
if (future.cause() instanceof RedisMovedException && !ignoreRedirect) {
RedisMovedException ex = (RedisMovedException) future.cause();
if (source.getRedirect() == Redirect.MOVED) {
details.getMainPromise().tryFailure(new RedisException("MOVED redirection loop detected. Node " + source.getAddr() + " has further redirect to " + ex.getUrl()));
return;
}
async(details.isReadOnlyMode(), new NodeSource(ex.getSlot(), ex.getUrl(), Redirect.MOVED), details.getCodec(),
details.getCommand(), details.getParams(), details.getMainPromise(), details.getAttempt(), ignoreRedirect);
AsyncDetails.release(details);
@ -864,6 +870,10 @@ public class CommandAsyncService implements CommandAsyncExecutor {
}
AsyncDetails.release(details);
} catch (RuntimeException e) {
details.getMainPromise().tryFailure(e);
throw e;
}
}
private <R, V> void handleReference(RPromise<R> mainPromise, R res) {

Loading…
Cancel
Save