Faraday :: ConnectionFailed。不遵守超时

时间:2019-07-18 07:23:43

标签: ruby-on-rails ruby timeout faraday

我将open_timeouttimeout都设置为2秒,但是当出现Faraday::ConnectionFailed错误时,它仅在5秒后超时。如何在2秒后使其超时?

(它对Net::ReadTimeout有效,它在2秒后超时。)

相关代码为:

Faraday.new(url: service_url) do |faraday|
  faraday.options.timeout = 2
  faraday.options.open_timeout = 2
end

0 个答案:

没有答案