调试完成

This commit is contained in:
mark.tian
2025-12-09 17:21:32 +08:00
parent 5b26207405
commit 0af7eebed8
23 changed files with 25 additions and 1142 deletions

View File

@@ -7,24 +7,33 @@ logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
# 创建Celery应用
app = Celery('tasks', broker='redis://localhost:6379/0', backend='redis://localhost:6379/0')
app = Celery(
'tasks',
broker='redis://localhost:6379/0',
backend='redis://localhost:6379/0',
include=['call_api_task']
)
# 配置Celery
app.conf.update(
timezone='Asia/Shanghai',
enable_utc=True,
enable_utc=False,
broker_url='redis://localhost:6379/0',
result_backend='redis://localhost:6379/0',
task_serializer='json',
accept_content=['json'],
result_serializer='json',
ask_track_started=True,
# Beat 调度配置
# crontab(hour=9, minute=0), # 每天上午9点执行
beat_schedule={
'daily-morning-task': {
'task': 'tasks.daily_morning_task',
'schedule': 60.0 * 2.0, # 每2分钟执行一次
'options': {'queue': 'default'}
'task': 'call_api',
'schedule': 60.0 * 2.0
},
},
# Flower监控配置
worker_send_task_events=True,
task_send_sent_event=True,