Skip to content

Commit

Permalink
Refactor Redis stats retrieval to use django-redis and improve code r…
Browse files Browse the repository at this point in the history
…eadability
  • Loading branch information
DonnieBLT committed Jan 1, 2025
1 parent d2c5663 commit 77e0bae
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions website/views/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
from django.views.decorators.csrf import csrf_exempt
from django.views.decorators.http import require_GET
from django.views.generic import TemplateView, View
from django_redis import get_redis_connection
from requests.auth import HTTPBasicAuth
from rest_framework import status
from rest_framework.decorators import api_view
Expand Down Expand Up @@ -155,8 +156,8 @@ def check_status(request):
# Get database connection count
status["db_connection_count"] = len(connection.queries)

# Get Redis stats
redis_client = redis.StrictRedis(host="localhost", port=6379, db=0)
# Get Redis stats using django-redis
redis_client = get_redis_connection("default")
status["redis_stats"] = redis_client.info()

# Add memory profiling information
Expand Down Expand Up @@ -677,9 +678,6 @@ def robots_txt(request):
return HttpResponse("\n".join(lines), content_type="text/plain")


import os


def get_last_commit_date():
try:
return (
Expand Down

0 comments on commit 77e0bae

Please sign in to comment.