Fixed - "None of slaves were synced" error is thrown during RLock acquisition.

pull/4695/head
Nikita Koksharov
parent 719863d948
commit 95ec3ee70c

@ -207,12 +207,13 @@ public abstract class RedissonBaseLock extends RedissonExpirable implements RLoc
protected <T> RFuture<T> evalWriteAsync(String key, Codec codec, RedisCommand<T> evalCommandType, String script, List<Object> keys, Object... params) {
MasterSlaveEntry entry = commandExecutor.getConnectionManager().getEntry(getRawName());
int availableSlaves;
if (entry != null) {
availableSlaves = entry.getAvailableSlaves();
} else {
availableSlaves = 0;
CompletionStage<Map<String, String>> replicationFuture = CompletableFuture.completedFuture(Collections.emptyMap());
if (!(commandExecutor instanceof CommandBatchService) && entry != null && entry.getAvailableSlaves() > 0) {
replicationFuture = commandExecutor.writeAsync(entry, null, RedisCommands.INFO_REPLICATION);
}
CompletionStage<T> resFuture = replicationFuture.thenCompose(r -> {
Integer availableSlaves = Integer.valueOf(r.getOrDefault("connected_slaves", "0"));
CommandBatchService executorService = createCommandBatchService(availableSlaves);
RFuture<T> result = executorService.evalWriteAsync(key, codec, evalCommandType, script, keys, params);
@ -233,7 +234,9 @@ public abstract class RedissonBaseLock extends RedissonExpirable implements RLoc
return commandExecutor.getNow(result.toCompletableFuture());
});
return new CompletableFutureWrapper<>(f);
return f;
});
return new CompletableFutureWrapper<>(resFuture);
}
private CommandBatchService createCommandBatchService(int availableSlaves) {

Loading…
Cancel
Save