-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
We have a number of hosts deployed with local redis instances that are accessed over a unix socket. The documentation is straightforward and this all works great. However, occasionally when hosts are brought down the socket may be removed, which breaks redis communication. This is also not a problem, but our error handling logic only gracefully resolves all redis related errors that stem from Redis::BaseError.
The connection error for a socket that does not exist is not wrapped with Redis::CannotConnectError. However, all sorts of other connection errors (e.g. unreachable hosts, timeouts, etc.) are. For example,
redis = Redis.new(:path => "/tmp/redis.sock")
redis.set("mykey", "hello world")
raises Errno::ENOENT: No such file or directory - connect(2) for /tmp/redis.sock
. However,
redis = Redis.new(:url => "redis://missing.host")
redis.set("mykey", "hello world")
raises Redis::CannotConnectError: Error connecting to Redis on missing.host:6379 (Errno::ECONNREFUSED)
essentially wrapping the underlying error.
Is this intentional or can I submit pull request that handles Errno::ENOENT alongside the other connection errors? Thanks.