diff --git a/redisson/src/main/java/org/redisson/liveobject/core/AccessorInterceptor.java b/redisson/src/main/java/org/redisson/liveobject/core/AccessorInterceptor.java index 1a38d3fc9..21dc611a1 100644 --- a/redisson/src/main/java/org/redisson/liveobject/core/AccessorInterceptor.java +++ b/redisson/src/main/java/org/redisson/liveobject/core/AccessorInterceptor.java @@ -210,7 +210,9 @@ public class AccessorInterceptor { } } - ce.execute(); + if (ce != commandExecutor) { + ce.execute(); + } } private void removeAsync(CommandBatchService ce, String name, String mapName, Codec codec, Object value, String fieldName) { diff --git a/redisson/src/test/java/org/redisson/RedissonLiveObjectServiceTest.java b/redisson/src/test/java/org/redisson/RedissonLiveObjectServiceTest.java index 520a15d31..cac62b05e 100644 --- a/redisson/src/test/java/org/redisson/RedissonLiveObjectServiceTest.java +++ b/redisson/src/test/java/org/redisson/RedissonLiveObjectServiceTest.java @@ -2,7 +2,6 @@ package org.redisson; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.*; import org.redisson.api.*; import org.redisson.api.annotation.*; import org.redisson.api.condition.Conditions; @@ -18,6 +17,7 @@ import java.util.*; import java.util.concurrent.*; import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.*; /** * @@ -359,6 +359,23 @@ public class RedissonLiveObjectServiceTest extends BaseTest { } } + @Test + public void testIndexedPersist() { + RLiveObjectService liveObjectService = redisson.getLiveObjectService(); + TestIndexed item1 = new TestIndexed("1"); + item1.setName1("testnma"); + item1.setName2("gfgfgf"); + item1.setNum1(123); + + TestIndexed item2 = new TestIndexed("2"); + + List s = liveObjectService.persist(item1, item2); + assertThat(s.get(0).getId()).isEqualTo(item1.getId()); + assertThat(s.get(1).getId()).isEqualTo(item2.getId()); + + redisson.shutdown(); + } + @Test public void testFindIn() { RLiveObjectService s = redisson.getLiveObjectService();