From 86f7ee28e88dddd81b50d06744ad3aee8914141b Mon Sep 17 00:00:00 2001 From: Nikita Date: Wed, 3 Aug 2016 13:36:16 +0300 Subject: [PATCH] Add exactly 1 second to blpop timeout. #565 --- src/main/java/org/redisson/command/CommandAsyncService.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/redisson/command/CommandAsyncService.java b/src/main/java/org/redisson/command/CommandAsyncService.java index aa4a4eee6..6a08cbec3 100644 --- a/src/main/java/org/redisson/command/CommandAsyncService.java +++ b/src/main/java/org/redisson/command/CommandAsyncService.java @@ -511,15 +511,14 @@ public class CommandAsyncService implements CommandAsyncExecutor { int timeoutTime = connectionManager.getConfig().getTimeout(); if (QueueCommand.TIMEOUTLESS_COMMANDS.contains(details.getCommand().getName())) { - // add 1.5 second due to issue https://github.com/antirez/redis/issues/874 - timeoutTime += Math.max(0, 1500 - timeoutTime); - Integer popTimeout = Integer.valueOf(details.getParams()[details.getParams().length - 1].toString()); handleBlockingOperations(details, connection, popTimeout); if (popTimeout == 0) { return; } timeoutTime += popTimeout*1000; + // add 1 second due to issue https://github.com/antirez/redis/issues/874 + timeoutTime += 1000; } final int timeoutAmount = timeoutTime;