conn = Faraday.new("https://api.example.com", request: {
open_timeout: 2, # opening a connection
timeout: 5 # waiting for response
})
conn.get(...)
Ruby 使用fariday时,加上timeout
参考: https://github.com/lostisland/faraday/issues/417
This post is licensed under
CC BY 4.0
by the author.