improve health check reliability

This commit is contained in:
Karol Wypchlo 2021-07-12 14:53:12 +02:00
parent a2aa850632
commit 36aa7c8311
1 changed files with 3 additions and 1 deletions

View File

@ -148,6 +148,8 @@ async def check_health():
res = requests.get(endpoint + "/health-check", verify=False) res = requests.get(endpoint + "/health-check", verify=False)
json_check = res.json() json_check = res.json()
server_down = res.status_code is not requests.codes["ok"]
res = requests.get(endpoint + "/health-check/critical", verify=False) res = requests.get(endpoint + "/health-check/critical", verify=False)
json_critical = res.json() json_critical = res.json()
@ -208,7 +210,7 @@ async def check_health():
if json_check["disabled"]: if json_check["disabled"]:
message += "__Portal manually disabled!__ " message += "__Portal manually disabled!__ "
elif res_check.status_code is not requests.codes["ok"]: elif server_down:
message += "__Portal down!!!__ " message += "__Portal down!!!__ "
force_notify = True force_notify = True