I noticed that when a http request times out, Ruby (2.6.1) makes a second request. This causes problems with one of our endpoints, because a second worker is triggered which takes up resources.
You can see an example here: Go to https://beeceptor.com/console/timeout and run the following code
require "net/http"
http = Net::HTTP.new("timeout.free.beeceptor.com", 443)
http.read_timeout = 1
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
http.request(Net::HTTP::Get.new("/Time"))
You can see that there are 2 requests to /Time
, so I was wondering:
- Whats the purpose of this default behaviour? When I do the same query with a curl command, I don't get a second request
curl --max-time 1 https://timeout.free.beeceptor.com
- How can I influence this behaviour?
- Or am I doing something wrong?