From e3771f5faeefe552bdaf51267bcc18f8c4f034c1 Mon Sep 17 00:00:00 2001 From: Georges-Antoine Assi Date: Mon, 30 Oct 2023 22:18:43 -0400 Subject: [PATCH] Use password for redis in redis.py --- backend/utils/cache.py | 9 --------- backend/utils/redis.py | 13 ++++++++++--- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/backend/utils/cache.py b/backend/utils/cache.py index 60c80519d..23a9e0428 100644 --- a/backend/utils/cache.py +++ b/backend/utils/cache.py @@ -2,15 +2,6 @@ from redis import Redis from config import REDIS_HOST, REDIS_PORT, REDIS_PASSWORD, ENABLE_EXPERIMENTAL_REDIS -redis_client = Redis( - host=REDIS_HOST, port=int(REDIS_PORT), password=REDIS_PASSWORD, db=0 -) -redis_url = ( - f"redis://:{REDIS_PASSWORD}@{REDIS_HOST}:{REDIS_PORT}" - if REDIS_PASSWORD - else f"redis://{REDIS_HOST}:{REDIS_PORT}" -) - class FallbackCache: def __init__(self) -> None: diff --git a/backend/utils/redis.py b/backend/utils/redis.py index 436dd240b..c6e13d950 100644 --- a/backend/utils/redis.py +++ b/backend/utils/redis.py @@ -1,11 +1,18 @@ from redis import Redis from rq import Queue -from config import REDIS_HOST, REDIS_PORT +from config import REDIS_HOST, REDIS_PORT, REDIS_PASSWORD -redis_client = Redis(host=REDIS_HOST, port=int(REDIS_PORT), db=0) -redis_url = f"redis://{REDIS_HOST}:{REDIS_PORT}/0" +redis_client = Redis( + host=REDIS_HOST, port=int(REDIS_PORT), password=REDIS_PASSWORD, db=0 +) +redis_url = ( + f"redis://:{REDIS_PASSWORD}@{REDIS_HOST}:{REDIS_PORT}" + if REDIS_PASSWORD + else f"redis://{REDIS_HOST}:{REDIS_PORT}" +) + high_prio_queue = Queue(name="high", connection=redis_client) default_queue = Queue(name="default", connection=redis_client)