From 8c3af7f4fffa9d16c17c3cd5dc98c3f314baf803 Mon Sep 17 00:00:00 2001 From: Ke Sun Date: Fri, 6 Mar 2026 16:35:24 +0800 Subject: [PATCH] fix(config): update default Redis DB numbers for Celery isolation - Change REDIS_DB_CELERY_BROKER default from 1 to 3 - Change REDIS_DB_CELERY_BACKEND default from 2 to 4 - Add documentation comments explaining DB isolation strategy - Prevent task interference when multiple developers share same Redis instance --- api/app/core/config.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/api/app/core/config.py b/api/app/core/config.py index ba17da93..bbe327b6 100644 --- a/api/app/core/config.py +++ b/api/app/core/config.py @@ -192,8 +192,10 @@ class Settings: # Celery configuration (internal) # NOTE: 变量名不以 CELERY_ 开头,避免被 Celery CLI 的前缀匹配机制劫持 # 详见 docs/celery-env-bug-report.md - REDIS_DB_CELERY_BROKER: int = int(os.getenv("REDIS_DB_CELERY_BROKER", "1")) - REDIS_DB_CELERY_BACKEND: int = int(os.getenv("REDIS_DB_CELERY_BACKEND", "2")) + # 默认使用 Redis DB 3 (broker) 和 DB 4 (backend),与业务缓存 (DB 1/2) 隔离 + # 多人共用同一 Redis 时,每位开发者应在 .env 中配置不同的 DB 编号避免任务互相干扰 + REDIS_DB_CELERY_BROKER: int = int(os.getenv("REDIS_DB_CELERY_BROKER", "3")) + REDIS_DB_CELERY_BACKEND: int = int(os.getenv("REDIS_DB_CELERY_BACKEND", "4")) # SMTP Email Configuration SMTP_SERVER: str = os.getenv("SMTP_SERVER", "smtp.gmail.com")