redis-rb icon indicating copy to clipboard operation
redis-rb copied to clipboard

Provide separate connection timeout and response timeout options

Open mfischer-zd opened this issue 11 years ago • 7 comments

Currently the :timeout option to the Redis constructor applies a latency ceiling both to the initial connection to the Redis server and to any responses to requests. This means you can't easily fail a connection within 1ms but fail a response (assuming the client successfully connected) that takes longer than 300ms.

Also, the error message is always Redis::TimeoutError: Connection timed out, even if the client successfully connected and the response timed out. This is highly misleading.

mfischer-zd avatar May 22 '14 23:05 mfischer-zd

Would love this feature.

vanchi-zendesk avatar May 22 '14 23:05 vanchi-zendesk

There should be a :connection_timeout in the options that is used by the drivers.

samshull avatar May 22 '14 23:05 samshull

I'd be all for an additional :connection_timeout parameter when constructing a new client. For legacy reasons, this should default to the value for :timeout.

Implementing separate exceptions for the connection-timeout and the command-timeout will be a bit tricky to do in a backwards-compatible way, since consumers of this library have historically relied on this one exception to mean both things and have handled it accordingly.

If you're willing to submit a pull-request, I would definitely work with you to get the proposed feature merged :+1:

yaauie avatar May 23 '14 01:05 yaauie

Implementing separate exceptions for the connection-timeout and the command-timeout will be a bit tricky to do in a backwards-compatible way, since consumers of this library have historically relied on this one exception to mean both things and have handled it accordingly.

Tricky? Do you mean impossible? :)

mfischer-zd avatar May 23 '14 01:05 mfischer-zd

:connect_timeout is already in master.

djanowski avatar Dec 11 '14 04:12 djanowski

If there is :connect_timeout, so not obvious the meaning of :timeout, isn't it?

plashchynski avatar Feb 20 '15 18:02 plashchynski

I'd love to see:

  1. timeout deprecated and replaced with read_timeout, the same term as used by Net::HTTP.
  2. the README updated to document the timeout options.

I will do this soon unless a committer objects.

mperham avatar May 07 '15 19:05 mperham

This has been solved for a while.

byroot avatar Aug 17 '22 18:08 byroot