Fixed - RedisTimeoutException arise during blocking command execution on RBlockingQueue and RBlockingDeque objects. #1434

pull/1461/head
Nikita 7 years ago
parent fe79bbf5f2
commit 29dff07e97

@ -726,10 +726,10 @@ public class CommandAsyncService implements CommandAsyncExecutor {
public void run(Timeout timeout) throws Exception { public void run(Timeout timeout) throws Exception {
// re-connection hasn't been made // re-connection hasn't been made
// and connection is still active // and connection is still active
if (orignalChannel == connection.getChannel() // if (orignalChannel == connection.getChannel()
&& connection.isActive()) { // && connection.isActive()) {
return; // return;
} // }
if (details.getAttemptPromise().trySuccess(null)) { if (details.getAttemptPromise().trySuccess(null)) {
connection.forceFastReconnectAsync(); connection.forceFastReconnectAsync();

@ -11,6 +11,15 @@ import org.redisson.api.RBlockingDeque;
public class RedissonBlockingDequeTest extends BaseTest { public class RedissonBlockingDequeTest extends BaseTest {
@Test
public void testPollLastAndOfferFirstTo() throws InterruptedException {
RBlockingDeque<String> blockingDeque = redisson.getBlockingDeque("blocking_deque");
long start = System.currentTimeMillis();
String redisTask = blockingDeque.pollLastAndOfferFirstTo("deque", 1, TimeUnit.SECONDS);
assertThat(System.currentTimeMillis() - start).isBetween(950L, 1050L);
assertThat(redisTask).isNull();
}
@Test(timeout = 3000) @Test(timeout = 3000)
public void testShortPoll() throws InterruptedException { public void testShortPoll() throws InterruptedException {
RBlockingDeque<Integer> queue = redisson.getBlockingDeque("queue:pollany"); RBlockingDeque<Integer> queue = redisson.getBlockingDeque("queue:pollany");

@ -38,7 +38,7 @@ public class RedissonBlockingQueueTest extends RedissonQueueTest {
return redisson.getBlockingQueue("queue"); return redisson.getBlockingQueue("queue");
} }
// @Test @Test
public void testPollWithBrokenConnection() throws IOException, InterruptedException, ExecutionException { public void testPollWithBrokenConnection() throws IOException, InterruptedException, ExecutionException {
RedisProcess runner = new RedisRunner() RedisProcess runner = new RedisRunner()
.nosave() .nosave()

Loading…
Cancel
Save