优化推送任务

This commit is contained in:
mark.tian
2025-12-05 06:20:14 +08:00
parent d3bbe5f649
commit 038363a17e
8 changed files with 288 additions and 751 deletions

View File

@@ -2,6 +2,10 @@ from pydantic_settings import BaseSettings
class Settings(BaseSettings):
@property
def redis_url(self) -> str:
"""从Celery配置获取Redis URL"""
return self.celery_broker_url
# 数据库配置
database_url: str = ""
@@ -14,11 +18,21 @@ class Settings(BaseSettings):
celery_timezone: str = "UTC"
celery_enable_utc: bool = True
# Redis配置 (从Celery配置获取)
redis_password: str = ""
redis_max_connections: int = 20
redis_timeout: int = 5
# 业务配置
count_threshold: int = 3 # count阈值,大于等于此值直接返回
external_api_enabled: bool = False # 是否启用外部API调用
external_api_retry_max: int = 3 # 外部API最大重试次数
external_api_url: str = ""
# Redis锁配置 (使用默认值)
redis_lock_timeout: int = 300 # 锁超时时间(秒)
redis_lock_max_retries: int = 10 # 最大重试次数
redis_lock_retry_delay: float = 0.5 # 重试延迟(秒)
# 日志配置
log_level: str = "INFO" # DEBUG, INFO, WARNING, ERROR, CRITICAL