标签: ruby-on-rails ruby timeout faraday
我将open_timeout和timeout都设置为2秒,但是当出现Faraday::ConnectionFailed错误时,它仅在5秒后超时。如何在2秒后使其超时?
open_timeout
timeout
Faraday::ConnectionFailed
(它对Net::ReadTimeout有效,它在2秒后超时。)
Net::ReadTimeout
相关代码为:
Faraday.new(url: service_url) do |faraday| faraday.options.timeout = 2 faraday.options.open_timeout = 2 end