From fe824978c1b480c90c0c479477c3ea119071e995 Mon Sep 17 00:00:00 2001 From: Nikita Date: Tue, 10 Nov 2015 11:50:27 +0300 Subject: [PATCH] SCAN iteration on same node fixed. #277 --- src/main/java/org/redisson/CommandExecutorService.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/redisson/CommandExecutorService.java b/src/main/java/org/redisson/CommandExecutorService.java index 068ee4076..06660b91f 100644 --- a/src/main/java/org/redisson/CommandExecutorService.java +++ b/src/main/java/org/redisson/CommandExecutorService.java @@ -440,7 +440,7 @@ public class CommandExecutorService implements CommandExecutor { ex.set(new RedisTimeoutException()); final Timeout timeout = connectionManager.getTimer().newTimeout(retryTimerTask, connectionManager.getConfig().getTimeout(), TimeUnit.MILLISECONDS); - Future connectionFuture; + final Future connectionFuture; if (readOnlyMode) { if (client != null) { connectionFuture = connectionManager.connectionReadOp(source, command, client); @@ -542,7 +542,11 @@ public class CommandExecutorService implements CommandExecutor { if (future.isSuccess()) { R res = future.getNow(); if (res instanceof RedisClientResult) { - ((RedisClientResult)res).setRedisClient(client); + RedisClient redisClient = client; + if (redisClient == null) { + redisClient = connectionFuture.getNow().getRedisClient(); + } + ((RedisClientResult)res).setRedisClient(redisClient); } mainPromise.setSuccess(res); } else {