Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Ruby 標準ライブラリを使用して永続的な接続を作成しています。
Net::HTTP.new(host, port)
しばらくアイドル状態になった後、Rubyは接続自体を閉じますか?
はい。MRI Ruby のデフォルトは 60 秒です。
http = Net::HTTP.new(host, port) http.read_timeout # -> 60
接続がタイムアウトしないようにする場合は、次のように設定できread_timeoutますnil
read_timeout
nil
http.read_timeout = nil