梳理main.py中的服务
This commit is contained in:
@@ -27,6 +27,13 @@ celery_app.conf.update(
|
||||
task_soft_time_limit=25 * 60, # 25分钟软超时
|
||||
worker_prefetch_multiplier=1,
|
||||
worker_max_tasks_per_child=1000,
|
||||
# Beat 调度配置
|
||||
beat_schedule={
|
||||
'push-data-to-dtc-every-minute': {
|
||||
'task': 'push_data_to_dtc',
|
||||
'schedule': 120.0, # 每60秒执行一次(1分钟)
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
logger.info("🌿 Celery应用配置完成")
|
||||
@@ -6,17 +6,25 @@ class Settings(BaseSettings):
|
||||
def redis_url(self) -> str:
|
||||
"""从Celery配置获取Redis URL"""
|
||||
return self.celery_broker_url
|
||||
|
||||
# 数据库配置
|
||||
database_url: str = ""
|
||||
|
||||
# Celery配置
|
||||
celery_broker_url: str = "redis://localhost:6379/0"
|
||||
celery_result_backend: str = "redis://localhost:6379/0"
|
||||
celery_result_backend: str = "redis://localhost:6379/1"
|
||||
celery_task_serializer: str = "json"
|
||||
celery_result_serializer: str = "json"
|
||||
celery_accept_content: list = ["json"]
|
||||
celery_timezone: str = "UTC"
|
||||
celery_enable_utc: bool = True
|
||||
celery_timezone: str = "Asia/Shanghai"
|
||||
celery_enable_utc: bool = False
|
||||
|
||||
# Flower监控配置
|
||||
flower_enabled: bool = True # 是否启用Flower监控
|
||||
flower_url: str = "http://localhost:5555" # Flower访问URL
|
||||
flower_port: int = 5555 # Flower服务端口
|
||||
flower_url_prefix: str = "" # Flower URL前缀
|
||||
flower_basic_auth: str = "admin:admin123" # Flower基础认证,格式:username:password
|
||||
|
||||
# Redis配置 (从Celery配置获取)
|
||||
redis_password: str = ""
|
||||
|
||||
Reference in New Issue
Block a user