From fe087eb591da92fdd71d1ab4b79efee9db28a376 Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Thu, 23 Jan 2025 11:34:24 +0000 Subject: [PATCH] Update more Redis URLs --- core/__init__.py | 16 +++++++++------- core/management/commands/processing.py | 13 +++++++------ 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/core/__init__.py b/core/__init__.py index 795035f..b0ef754 100644 --- a/core/__init__.py +++ b/core/__init__.py @@ -6,13 +6,15 @@ from redis import StrictRedis os.environ["DJANGO_ALLOW_ASYNC_UNSAFE"] = "true" - -r = StrictRedis( - host=settings.REDIS_HOST, - port=settings.REDIS_PORT, - password=settings.REDIS_PASSWORD, - db=settings.REDIS_DB -) +# /var/run/neptune-redis.sock +# use the socket +r = StrictRedis(unix_socket_path="/var/run/neptune-redis.sock", db=settings.REDIS_DB) +# r = StrictRedis( +# host=settings.REDIS_HOST, +# port=settings.REDIS_PORT, +# password=settings.REDIS_PASSWORD, +# db=settings.REDIS_DB +# ) if settings.STRIPE_TEST: stripe.api_key = settings.STRIPE_API_KEY_TEST diff --git a/core/management/commands/processing.py b/core/management/commands/processing.py index 5e75b0b..d526dd7 100644 --- a/core/management/commands/processing.py +++ b/core/management/commands/processing.py @@ -94,12 +94,13 @@ def process_rules(data): class Command(BaseCommand): def handle(self, *args, **options): - r = StrictRedis( - host=settings.REDIS_HOST, - port=settings.REDIS_PORT, - password=settings.REDIS_PASSWORD, - db=settings.REDIS_DB - ) + r = StrictRedis(unix_socket_path="/var/run/neptune-redis.sock", db=10) # To match Monolith DB + # r = StrictRedis( + # host=settings.REDIS_HOST, + # port=settings.REDIS_PORT, + # password=settings.REDIS_PASSWORD, + # db=settings.REDIS_DB + # ) p = r.pubsub() p.psubscribe("messages") for message in p.listen():