Skip to content

Commit f950c68

Browse files
committed
feat(config): make Redis URL configurable for horizontal scaling
1 parent 2fa4ce0 commit f950c68

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

backend/config/paths.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import os
22

3+
REDIS_URL = os.getenv("REDIS_URL", "redis://localhost:6379")
4+
35

46
def get_tmp_thread_files(uid):
57
return [get_thread_filepath(uid, UPLOAD_DIR), get_thread_filepath(uid, RESULTS_DIR)]

backend/utils/task.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from backend.config.paths import (
77
ARTIFACTS_AI_CSV_FILE,
88
MODEL_ONNX_FILE,
9+
REDIS_URL,
910
RESULTS_DIR,
1011
get_thread_filepath,
1112
get_tmp_thread_files,
@@ -20,9 +21,7 @@
2021
send_publish_results_by_email,
2122
)
2223

23-
celery_app = Celery(
24-
"tasks", broker="redis://localhost:6379", backend="redis://localhost:6379"
25-
)
24+
celery_app = Celery("tasks", broker=REDIS_URL, backend=REDIS_URL)
2625

2726
celery_app.conf.update(
2827
worker_hijack_root_logger=False,

0 commit comments

Comments
 (0)