Batch big response decoding fixed. #200

pull/243/head
Nikita 10 years ago
parent eba917f4f2
commit 75b10296fe

@ -124,7 +124,18 @@ public class CommandDecoder extends ReplayingDecoder<State> {
} }
} }
commands.getPromise().setSuccess(null); if (i == commands.getCommands().size()) {
commands.getPromise().setSuccess(null);
ctx.channel().attr(CommandsQueue.REPLAY).remove();
ctx.pipeline().fireUserEventTriggered(QueueCommands.NEXT_COMMAND);
state(null);
} else {
checkpoint();
state().setIndex(i);
}
return;
} }
ctx.channel().attr(CommandsQueue.REPLAY).remove(); ctx.channel().attr(CommandsQueue.REPLAY).remove();

@ -7,9 +7,35 @@ import java.util.Map;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import org.redisson.core.RBatch; import org.redisson.core.RBatch;
import org.redisson.core.RListAsync;
public class RedissonBatchTest extends BaseTest { public class RedissonBatchTest extends BaseTest {
@Test
public void testBatchList() {
RBatch b = redisson.createBatch();
RListAsync<Integer> listAsync = b.getList("list");
for (int i = 1; i < 540; i++) {
listAsync.addAsync(i);
}
List<?> res = b.execute();
Assert.assertEquals(539, res.size());
}
@Test
public void testBatchBigRequest() {
RBatch batch = redisson.createBatch();
for (int i = 0; i < 210; i++) {
batch.getMap("test").fastPutAsync("1", "2");
batch.getMap("test").fastPutAsync("2", "3");
batch.getMap("test").putAsync("2", "5");
batch.getAtomicLongAsync("counter").incrementAndGetAsync();
batch.getAtomicLongAsync("counter").incrementAndGetAsync();
}
List<?> res = batch.execute();
Assert.assertEquals(210*5, res.size());
}
@Test(expected=IllegalStateException.class) @Test(expected=IllegalStateException.class)
public void testTwice() { public void testTwice() {
RBatch batch = redisson.createBatch(); RBatch batch = redisson.createBatch();

Loading…
Cancel
Save