Skip to content

Commit

Permalink
Support WAIT in Pipeline (#2600)
Browse files Browse the repository at this point in the history
* Support WAIT in Pipeline

* test wait in pipeline
  • Loading branch information
sazzad16 committed Jul 20, 2021
1 parent df05370 commit acacf69
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/main/java/redis/clients/jedis/Pipeline.java
Original file line number Diff line number Diff line change
Expand Up @@ -157,4 +157,9 @@ public void close() {
clear();
}

public Response<Long> waitReplicas(int replicas, long timeout) {
client.waitReplicas(replicas, timeout);
return getResponse(BuilderFactory.LONG);
}

}
13 changes: 13 additions & 0 deletions src/test/java/redis/clients/jedis/tests/PipeliningTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,19 @@ public void testDiscardInPipeline() {
get.get();
}

@Test
public void waitReplicas() {
Pipeline p = jedis.pipelined();
p.set("wait", "replicas");
p.waitReplicas(1, 10);
p.sync();

try (Jedis j = new Jedis(HostAndPortUtil.getRedisServers().get(4))) {
j.auth("foobared");
assertEquals("replicas", j.get("wait"));
}
}

@Test
public void testEval() {
String script = "return 'success!'";
Expand Down

0 comments on commit acacf69

Please sign in to comment.