Skip to content

Commit acacf69

Browse files
committed
Support WAIT in Pipeline (redis#2600)
* Support WAIT in Pipeline * test wait in pipeline
1 parent df05370 commit acacf69

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/main/java/redis/clients/jedis/Pipeline.java

+5
Original file line numberDiff line numberDiff line change
@@ -157,4 +157,9 @@ public void close() {
157157
clear();
158158
}
159159

160+
public Response<Long> waitReplicas(int replicas, long timeout) {
161+
client.waitReplicas(replicas, timeout);
162+
return getResponse(BuilderFactory.LONG);
163+
}
164+
160165
}

src/test/java/redis/clients/jedis/tests/PipeliningTest.java

+13
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,19 @@ public void testDiscardInPipeline() {
409409
get.get();
410410
}
411411

412+
@Test
413+
public void waitReplicas() {
414+
Pipeline p = jedis.pipelined();
415+
p.set("wait", "replicas");
416+
p.waitReplicas(1, 10);
417+
p.sync();
418+
419+
try (Jedis j = new Jedis(HostAndPortUtil.getRedisServers().get(4))) {
420+
j.auth("foobared");
421+
assertEquals("replicas", j.get("wait"));
422+
}
423+
}
424+
412425
@Test
413426
public void testEval() {
414427
String script = "return 'success!'";

0 commit comments

Comments
 (0)