do not send message on server down

This commit is contained in:
Karol Wypchlo 2021-09-10 17:00:37 +02:00
parent 4fddbb2fc8
commit bcea4d5b90
No known key found for this signature in database
GPG Key ID: C92C016317A964D0
1 changed files with 3 additions and 4 deletions

View File

@ -133,7 +133,7 @@ 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"] server_failure = res.status_code is not requests.codes["ok"] and json_check["disabled"] == False:
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()
@ -201,8 +201,8 @@ async def check_health():
message = "" message = ""
force_notify = False force_notify = False
if server_down and json_check["disabled"] == False: if server_failure:
message += "__Portal down!!!__ " message += "__Server down!!!__ "
force_notify = True force_notify = True
if critical_checks_failed: if critical_checks_failed:
@ -227,7 +227,6 @@ async def check_health():
# send a message if we force notification, there is a failures dump or just once daily (heartbeat) on 1 AM # send a message if we force notification, there is a failures dump or just once daily (heartbeat) on 1 AM
if ( if (
force_notify force_notify
or json_check["disabled"]
or failed_records_file or failed_records_file
or datetime.utcnow().hour == 1 or datetime.utcnow().hour == 1
): ):