fix issue 108, brpoplpush set infinite timeout before waiting for a reply from the server
This commit is contained in:
@@ -2898,7 +2898,10 @@ public class BinaryJedis implements BinaryJedisCommands {
|
|||||||
*/
|
*/
|
||||||
public byte[] brpoplpush(byte[] source, byte[] destination, int timeout) {
|
public byte[] brpoplpush(byte[] source, byte[] destination, int timeout) {
|
||||||
client.brpoplpush(source, destination, timeout);
|
client.brpoplpush(source, destination, timeout);
|
||||||
return client.getBinaryBulkReply();
|
client.setTimeoutInfinite();
|
||||||
|
byte[] reply = client.getBinaryBulkReply();
|
||||||
|
client.rollbackTimeout();
|
||||||
|
return reply;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -2570,7 +2570,10 @@ public class Jedis extends BinaryJedis implements JedisCommands {
|
|||||||
*/
|
*/
|
||||||
public String brpoplpush(String source, String destination, int timeout) {
|
public String brpoplpush(String source, String destination, int timeout) {
|
||||||
client.brpoplpush(source, destination, timeout);
|
client.brpoplpush(source, destination, timeout);
|
||||||
return client.getBulkReply();
|
client.setTimeoutInfinite();
|
||||||
|
String reply = client.getBulkReply();
|
||||||
|
client.rollbackTimeout();
|
||||||
|
return reply;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -585,7 +585,7 @@ public class ListCommandsTest extends JedisCommandTestBase {
|
|||||||
(new Thread(new Runnable() {
|
(new Thread(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
Thread.sleep(100);
|
Thread.sleep(2000);
|
||||||
Jedis j = createJedis();
|
Jedis j = createJedis();
|
||||||
j.lpush("foo", "a");
|
j.lpush("foo", "a");
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user