From 1bc0f1ffb4b188a4ece65a6f001c3562acb13cfd Mon Sep 17 00:00:00 2001 From: dengliming Date: Mon, 15 Mar 2021 23:30:36 +0800 Subject: [PATCH] Fix xrevrange in PipelineBase (#2436) --- src/main/java/redis/clients/jedis/PipelineBase.java | 13 +++++++------ .../jedis/tests/commands/StreamsCommandsTest.java | 5 +++++ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/main/java/redis/clients/jedis/PipelineBase.java b/src/main/java/redis/clients/jedis/PipelineBase.java index 7cc83cb20e..c071ce4500 100644 --- a/src/main/java/redis/clients/jedis/PipelineBase.java +++ b/src/main/java/redis/clients/jedis/PipelineBase.java @@ -1997,15 +1997,16 @@ public Response> xrange(byte[] key, byte[] start, byte[] end, int c } @Override - public Response> xrevrange(String key, StreamEntryID end, StreamEntryID start, int count){ - getClient(key).xrevrange(key, start, end, count); - return getResponse(BuilderFactory.STREAM_ENTRY_LIST); + public Response> xrevrange(String key, StreamEntryID end, StreamEntryID start, + int count) { + getClient(key).xrevrange(key, end, start, count); + return getResponse(BuilderFactory.STREAM_ENTRY_LIST); } @Override - public Response> xrevrange(byte[] key, byte[] end, byte[] start, int count){ - getClient(key).xrevrange(key, start, end, count); - return getResponse(BuilderFactory.BYTE_ARRAY_LIST); + public Response> xrevrange(byte[] key, byte[] end, byte[] start, int count) { + getClient(key).xrevrange(key, end, start, count); + return getResponse(BuilderFactory.BYTE_ARRAY_LIST); } diff --git a/src/test/java/redis/clients/jedis/tests/commands/StreamsCommandsTest.java b/src/test/java/redis/clients/jedis/tests/commands/StreamsCommandsTest.java index d206c2d38c..e80b1d2e3d 100644 --- a/src/test/java/redis/clients/jedis/tests/commands/StreamsCommandsTest.java +++ b/src/test/java/redis/clients/jedis/tests/commands/StreamsCommandsTest.java @@ -525,6 +525,11 @@ public void pipeline() { assertEquals(map, entries.get(0).getFields()); assertEquals(id2.get(), entries.get(1).getID()); assertEquals(map, entries.get(1).getFields()); + + p = jedis.pipelined(); + Response> results2 = p.xrevrange("stream1", null, id1.get(), 2); + p.sync(); + assertEquals(2, results2.get().size()); } @Test