Skip to content

Commit

Permalink
Improve error message on timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
byroot committed Aug 23, 2024
1 parent 5ecaac3 commit 2b87d4d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/redis_client/ruby_connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,12 @@ def connect
UNIXSocket.new(@config.path)
else
sock = if SUPPORTS_RESOLV_TIMEOUT
Socket.tcp(@config.host, @config.port, connect_timeout: @connect_timeout, resolv_timeout: @connect_timeout)
begin
Socket.tcp(@config.host, @config.port, connect_timeout: @connect_timeout, resolv_timeout: @connect_timeout)
rescue Errno::ETIMEDOUT => timeout_error
timeout_error.message << ": #{@connect_timeout}s"
raise
end
else
Socket.tcp(@config.host, @config.port, connect_timeout: @connect_timeout)
end
Expand Down

0 comments on commit 2b87d4d

Please sign in to comment.