mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Added timeout to http calls, switched get to head
This commit is contained in:
parent
6e776d6383
commit
a26159f510
@ -17,7 +17,7 @@ class HTTPHandler(BaseHandler):
|
|||||||
url = "https://" + url
|
url = "https://" + url
|
||||||
db_port = self.helper.get_setting("https_port")
|
db_port = self.helper.get_setting("https_port")
|
||||||
try:
|
try:
|
||||||
resp = requests.get(url + ":" + str(port))
|
resp = requests.head(url + ":" + str(port), timeout=(0.5, 5))
|
||||||
resp.raise_for_status()
|
resp.raise_for_status()
|
||||||
except Exception:
|
except Exception:
|
||||||
port = db_port
|
port = db_port
|
||||||
@ -35,7 +35,7 @@ class HTTPHandlerPage(BaseHandler):
|
|||||||
url = "https://" + url
|
url = "https://" + url
|
||||||
db_port = self.helper.get_setting("https_port")
|
db_port = self.helper.get_setting("https_port")
|
||||||
try:
|
try:
|
||||||
resp = requests.get(url + ":" + str(port))
|
resp = requests.head(url + ":" + str(port), timeout=(0.5, 5))
|
||||||
resp.raise_for_status()
|
resp.raise_for_status()
|
||||||
except Exception:
|
except Exception:
|
||||||
port = db_port
|
port = db_port
|
||||||
|
@ -25,7 +25,7 @@ class HTTPHandlerPage(BaseHandler):
|
|||||||
backup_url = url + str(self.helper.get_setting("https_port"))
|
backup_url = url + str(self.helper.get_setting("https_port"))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
resp = requests.get(primary_url)
|
resp = requests.head(primary_url, timeout=(0.5, 5))
|
||||||
resp.raise_for_status()
|
resp.raise_for_status()
|
||||||
url = primary_url
|
url = primary_url
|
||||||
except Exception:
|
except Exception:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user