From 477440231d4a7ea8be076ad75ce7cd51187237b4 Mon Sep 17 00:00:00 2001 From: Wilfried BARADAT Date: Mon, 15 Apr 2024 16:45:08 +0200 Subject: [PATCH] Fix docstrings about heartbeat status on warnings (200, not 5XX) All implementations of heartbeat now return a 500 response only for errors or worse. Docstrings needs to be updated. --- src/dockerflow/django/views.py | 4 ++-- src/dockerflow/flask/app.py | 4 ++-- src/dockerflow/sanic/app.py | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/dockerflow/django/views.py b/src/dockerflow/django/views.py index 0760c68..2f0bcfe 100644 --- a/src/dockerflow/django/views.py +++ b/src/dockerflow/django/views.py @@ -50,8 +50,8 @@ def heartbeat(request): Runs all the Django checks and returns a JsonResponse with either a status code of 200 or 500 depending on the results of the checks. - Any check that returns a warning or worse (error, critical) will - return a 500 response. + Any check that returns an error or worse (critical) will return + a 500 response. """ checks_to_run = ( (check.__name__, lambda: check(app_configs=None)) diff --git a/src/dockerflow/flask/app.py b/src/dockerflow/flask/app.py index e747c2f..70c14c5 100644 --- a/src/dockerflow/flask/app.py +++ b/src/dockerflow/flask/app.py @@ -314,8 +314,8 @@ def _heartbeat_view(self): Runs all the registered checks and returns a JSON response with either a status code of 200 or 500 depending on the results of the checks. - Any check that returns a warning or worse (error, critical) will - return a 500 response. + Any check that returns an error or worse (critical) will return + a 500 response. """ FAILED_STATUS_CODE = int( flask.current_app.config.get( diff --git a/src/dockerflow/sanic/app.py b/src/dockerflow/sanic/app.py index 6276b43..23641dd 100644 --- a/src/dockerflow/sanic/app.py +++ b/src/dockerflow/sanic/app.py @@ -213,8 +213,8 @@ async def _heartbeat_view(self, request): Runs all the registered checks and returns a JSON response with either a status code of 200 or 500 depending on the results of the checks. - Any check that returns a warning or worse (error, critical) will - return a 500 response. + Any check that returns an error or worse (critical) will return + a 500 response. """ FAILED_STATUS_CODE = int( request.app.config.get("DOCKERFLOW_HEARTBEAT_FAILED_STATUS_CODE", "500")