diff --git a/src/main/java/org/redisson/RedissonList.java b/src/main/java/org/redisson/RedissonList.java index 0cd9f0cbe..6525a5549 100644 --- a/src/main/java/org/redisson/RedissonList.java +++ b/src/main/java/org/redisson/RedissonList.java @@ -367,9 +367,15 @@ public class RedissonList extends RedissonExpirable implements RList { private Future indexOfAsync(Object o, Convertor convertor) { return commandExecutor.evalReadAsync(getName(), new RedisCommand("EVAL", convertor, 4), - "local s = redis.call('llen', KEYS[1]);" + - "for i = 0, s, 1 do if ARGV[1] == redis.call('lindex', KEYS[1], i) then return i end end;" + - "return -1", + "local key = KEYS[1] " + + "local obj = ARGV[1] " + + "local items = redis.call('lrange', key, 0, -1) " + + "for i=1,#items do " + + "if items[i] == obj then " + + "return i - 1 " + + "end " + + "end " + + "return -1", Collections.singletonList(getName()), o); }