Skip to content

Commit

Permalink
Add wait on blocking commands for an extra config.read_timeout
Browse files Browse the repository at this point in the history
Previously we were waiting an extra 100ms which is totally arbitrary
and might not be enough.
  • Loading branch information
byroot committed Jan 16, 2023
1 parent f78beb1 commit d3efeeb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/redis/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ def call_v(command, &block)
def blocking_call_v(timeout, command, &block)
if timeout && timeout > 0
# Can't use the command timeout argument as the connection timeout
# otherwise it would be very racy. So we add an extra 100ms to account for
# the network delay.
timeout += 0.1
# otherwise it would be very racy. So we add the regular read_timeout on top
# to account for the network delay.
timeout += config.read_timeout
end

super(timeout, command, &block)
Expand Down

0 comments on commit d3efeeb

Please sign in to comment.