Added healtchecks on startup

This commit is contained in:
Luca Sorace "Stranck 2024-02-13 14:17:21 +01:00
parent 7574a9d356
commit 878719260d
2 changed files with 6 additions and 2 deletions

3
app.py
View File

@ -199,6 +199,9 @@ if __name__ == "__main__":
res = requests.get(base_url_event, headers=headers) res = requests.get(base_url_event, headers=headers)
res = res.json() res = res.json()
if(res['slug'] == EVENT_NAME): if(res['slug'] == EVENT_NAME):
print("Healtchecking...", file=sys.stderr)
res = requests.get(join(domain, "healthcheck"), headers=headers)
if(res.status_code == 200):
break break
except: except:
pass pass

View File

@ -7,7 +7,8 @@ EVENT_NAME = 'overlord'
HOSTNAME = 'reg.furizon.net' HOSTNAME = 'reg.furizon.net'
headers = {'Host': HOSTNAME, 'Authorization': f'Token {API_TOKEN}'} headers = {'Host': HOSTNAME, 'Authorization': f'Token {API_TOKEN}'}
base_url = "http://urlllllllllllllllllllll/api/v1/" domain = "http://urlllllllllllllllllllll/"
base_url = "{domain}api/v1/"
base_url_event = f"{base_url}organizers/{ORGANIZER}/events/{EVENT_NAME}/" base_url_event = f"{base_url}organizers/{ORGANIZER}/events/{EVENT_NAME}/"
PROPIC_DEADLINE = 9999999999 PROPIC_DEADLINE = 9999999999