Skip to content

Commit

Permalink
Only wait for an extra 100ms for blocking calls
Browse files Browse the repository at this point in the history
  • Loading branch information
byroot committed Aug 18, 2022
1 parent 9c808aa commit 6e90332
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/redis/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,13 @@ def call_v(command, &block)
end

def blocking_call_v(timeout, command, &block)
timeout += self.timeout if timeout && timeout > 0
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
end

super(timeout, command, &block)
rescue ::RedisClient::Error => error
raise ERROR_MAPPING.fetch(error.class), error.message, error.backtrace
Expand Down

0 comments on commit 6e90332

Please sign in to comment.