Skip to content

Commit

Permalink
Remove API health check
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnyunar committed Jan 28, 2025
1 parent 66c6c92 commit 2e9c4a8
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 19 deletions.
2 changes: 1 addition & 1 deletion api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ class HealthCheckViewSet(ViewSet):

def list(self, request):
healthchecks = HealthCheckRegistry.get_registered_healthchecks()
results = {check.name: check.check(request=request) for check in healthchecks}
results = {check.name: check.check() for check in healthchecks}
return Response(results)


Expand Down
15 changes: 0 additions & 15 deletions health/healthchecks/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,18 +67,3 @@ def check(self, **kwargs) -> dict:
return {"status": "ok"}
except Exception as e:
return {"status": "error", "details": str(e)}


@register_healthcheck
class APIHealthCheck(BaseHealthCheck):
name = "api"

def check(self, **kwargs) -> dict:
request = kwargs.get("request")
try:
full_url = request.build_absolute_uri(reverse("api:ping-list"))
response = requests.get(full_url)
response.raise_for_status()
return {"status": "ok"}
except requests.RequestException as e:
return {"status": "error", "details": str(e)}
4 changes: 1 addition & 3 deletions health/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ def generate_healthcheck_results(self, request) -> dict:
Generate fresh health check results.
"""
healthchecks = HealthCheckRegistry.get_registered_healthchecks()
results = {
check.verbose_name: check.check(request=request) for check in healthchecks
}
results = {check.verbose_name: check.check() for check in healthchecks}
last_update = now()
return {"results": results, "last_update": last_update}

Expand Down

0 comments on commit 2e9c4a8

Please sign in to comment.