From 15ef2cb8bbb455f5a654067db15ae77e7308ed96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Hells=C3=A9n?= Date: Mon, 19 Dec 2022 17:34:35 +0100 Subject: [PATCH] Update healthcheck.py --- discord_rss_bot/healthcheck.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/discord_rss_bot/healthcheck.py b/discord_rss_bot/healthcheck.py index 333e6e1..71b3e31 100644 --- a/discord_rss_bot/healthcheck.py +++ b/discord_rss_bot/healthcheck.py @@ -7,12 +7,17 @@ import requests def healthcheck(): - """Check if the website is up.""" + """Check if the website is up. + + sys.exit(0): success - the container is healthy and ready for use. + sys.exit(1): unhealthy - the container is not working correctly.""" + # TODO: We should check more than just that the website is up. try: r = requests.get("http://localhost:5000") if r.ok: sys.exit(0) - except requests.exceptions.RequestException: + except requests.exceptions.RequestException as e: + print(f"ERROR: {e}") sys.exit(1)