mirror of https://github.com/aredn/aredn.git
Add a maximum timeout for service checks.
The connec timeout did not include DNS looksup, and if DNS is broken this can hang forever. Add a maxmimum timeout so this call will eventually terminate regardless.
This commit is contained in:
parent
fb6060cf3a
commit
8b3551b539
|
@ -192,7 +192,7 @@ if validate then
|
|||
valid_services[#valid_services + 1] = service
|
||||
elseif proto == "http" then
|
||||
-- http so looks like a link. http check it
|
||||
local status, effective_url = io.popen("/usr/bin/curl --retry 0 --connect-timeout 2 --speed-time 5 --speed-limit 1000 --silent --output /dev/null --location --write-out '%{http_code} %{url_effective}' " .. "http://" .. hostname .. ":" .. port .. path):read("*a"):match("^(%d+) (.*)")
|
||||
local status, effective_url = io.popen("/usr/bin/curl --max-time 10 --retry 0 --connect-timeout 2 --speed-time 5 --speed-limit 1000 --silent --output /dev/null --location --write-out '%{http_code} %{url_effective}' " .. "http://" .. hostname .. ":" .. port .. path):read("*a"):match("^(%d+) (.*)")
|
||||
if status == "200" or status == "401" then
|
||||
valid_services[#valid_services + 1] = service
|
||||
elseif status == "301" or status == "302" or status == "303" or status == "307" or status == "308" then
|
||||
|
|
Loading…
Reference in New Issue