Home Ruby 使用fariday时,加上timeout
Post
Cancel

Ruby 使用fariday时,加上timeout

参考: https://github.com/lostisland/faraday/issues/417
conn = Faraday.new("https://api.example.com", request: {
  open_timeout: 2,   # opening a connection
  timeout: 5         # waiting for response
})

conn.get(...)
This post is licensed under CC BY 4.0 by the author.