Skip to content

Commit 6e90332

Browse files
committed
Only wait for an extra 100ms for blocking calls
1 parent 9c808aa commit 6e90332

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/redis/client.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,13 @@ def call_v(command, &block)
8282
end
8383

8484
def blocking_call_v(timeout, command, &block)
85-
timeout += self.timeout if timeout && timeout > 0
85+
if timeout && timeout > 0
86+
# Can't use the command timeout argument as the connection timeout
87+
# otherwise it would be very racy. So we add an extra 100ms to account for
88+
# the network delay.
89+
timeout += 0.1
90+
end
91+
8692
super(timeout, command, &block)
8793
rescue ::RedisClient::Error => error
8894
raise ERROR_MAPPING.fetch(error.class), error.message, error.backtrace

0 commit comments

Comments
 (0)