Closed jhawthorn closed 6 months ago
FYI, Dalli started using connect_timeout
recently and it's been problematic. That's not to say you shouldn't use connect_timeout
, but I wanted to highlight that it could be problematic through Ruby 3.4 due to the presence of resolv-replace in the standard library.
Thanks for the warning. I think we're not going to hit any similar problems as this is our own :connect_timeout
option not Socket
's (though that's good to keep in mind for the future as I am interested in exploring using a Ruby socket)
After the initial non-blocking connection call, we wait for the socket to become writable as a signal that it has been successful (non-blocking connects otherwise return immediately).
Previously this "writable" check used the write timeout instead of the connect timeout, which may have been confusing for users. IMO this was a bug introduced at some point prior to public release (at one time the writable check didn't exist and the connect_timeout worked as one would expect).
This commit adds a new TRILOGY_WAIT_CONNECT, which uses connect_timeout to wait for the connection to become writable. If connect_timeout isn't set it will use write_timeout for backwards compatibility.