Skip to content

Commit

Permalink
OpenConceptLab/ocl_issues#927 Redis clustering, fixing healthcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
rkorytkowski committed Jul 25, 2023
1 parent 6a70918 commit 28ded2f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion core/common/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from django.contrib.auth.backends import ModelBackend
from django.core.files.base import ContentFile
from django.db import connection
from django_redis import get_redis_connection
from mozilla_django_oidc.contrib.drf import OIDCAuthentication
from pydash import get
from rest_framework.authentication import TokenAuthentication
Expand Down Expand Up @@ -216,7 +217,7 @@ def __resource(cls):

class RedisService: # pragma: no cover
def __init__(self):
self.conn = redis.Redis(host=REDIS_HOST, port=REDIS_PORT, db=REDIS_DB)
self.conn = get_redis_connection('default')

def set(self, key, val, **kwargs):
return self.conn.set(key, val, **kwargs)
Expand Down
2 changes: 1 addition & 1 deletion ping_celery_worker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ CELERY_WORKER_NAME=${CELERY_WORKER_NAME:-""}
CELERY_WORKER_NAME_WITH_UUID=`cat /temp/celery-worker-$CELERY_WORKER_NAME.tmp`

# Providing broker with -b is more efficient than -A as the app does not have to be initialized on each ping
celery -b redis://${REDIS_HOST:-localhost}:${REDIS_PORT:-6379}/0 inspect ping -t 60 -d "celery@$CELERY_WORKER_NAME_WITH_UUID"
celery -A core.celery inspect ping -t 60 -d "celery@$CELERY_WORKER_NAME_WITH_UUID"
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ git+https://github.com/OpenConceptLab/ocldev
coverage==7.2.7
tblib==2.0.0
django-ordered-model==3.7.4
django-health-check==3.16.2
django-health-check==3.17.0
markdown==3.4.3
mock==5.0.2
django-request-logging==0.7.5
Expand Down

0 comments on commit 28ded2f

Please sign in to comment.