将文件夹命名从拼音改为英文,整理了一些代码,将导入语句迁移到了头部
This commit is contained in:
@@ -1,12 +1,6 @@
|
||||
"""
|
||||
阿龙电竞 - Celery定时任务主配置
|
||||
生产环境就绪版本,支持精确延时任务和周期性任务
|
||||
"""
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import os
|
||||
from celery import Celery
|
||||
from celery.schedules import crontab
|
||||
@@ -26,14 +20,9 @@ app.config_from_object('django.conf:settings', namespace='CELERY')
|
||||
#app.autodiscover_tasks()
|
||||
app.autodiscover_tasks(['yonghu.tasks', 'yonghu.ranking_tasks', 'dingdan.tasks', 'peizhi.tasks'])
|
||||
|
||||
|
||||
|
||||
# 配置周期性任务(Celery Beat Schedule)
|
||||
app.conf.beat_schedule = {
|
||||
|
||||
|
||||
|
||||
|
||||
# 月榜数据转移(每月最后一天23:50执行)
|
||||
'yuebang_zhuanyi': {
|
||||
'task': 'yonghu.ranking_tasks.zhuanyi_yuebang',
|
||||
@@ -41,8 +30,6 @@ app.conf.beat_schedule = {
|
||||
'options': {'queue': 'periodic_tasks', 'priority': 7},
|
||||
},
|
||||
|
||||
|
||||
|
||||
# 日榜数据转移(每天23:55执行,在清零前)
|
||||
'ribang_zhuanyi': {
|
||||
'task': 'yonghu.ranking_tasks.zhuanyi_ribang',
|
||||
@@ -51,8 +38,6 @@ app.conf.beat_schedule = {
|
||||
'options': {'queue': 'periodic_tasks', 'priority': 7}, # 优先级高于清零任务
|
||||
},
|
||||
|
||||
|
||||
|
||||
# 清理旧历史数据(每月1号凌晨1点执行)
|
||||
'qingli_jiulishuju': {
|
||||
'task': 'yonghu.ranking_tasks.qingli_jiulishuju',
|
||||
@@ -60,21 +45,13 @@ app.conf.beat_schedule = {
|
||||
'options': {'queue': 'periodic_tasks', 'priority': 4},
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# 🔥 补偿检查任务(每5分钟运行)
|
||||
# 补偿检查任务(每5分钟运行)
|
||||
'check_order_expire_task': {
|
||||
'task': 'dingdan.tasks.check_order_expire_task',
|
||||
'schedule': crontab(minute='*/5000'),
|
||||
'options': {'queue': 'order_tasks', 'priority': 3},
|
||||
},
|
||||
|
||||
|
||||
# 1. 每日凌晨0点执行 - 清零任务
|
||||
'daily_reset_task': {
|
||||
'task': 'yonghu.tasks.daily_reset_task',
|
||||
@@ -99,10 +76,6 @@ app.conf.beat_schedule = {
|
||||
'kwargs': {}
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# 4. 每天凌晨0点5分清理收支记录
|
||||
'daily_sz_reset_task': {
|
||||
'task': 'peizhi.tasks.daily_sz_reset_task',
|
||||
@@ -197,4 +170,4 @@ app.conf.task_acks_late = True
|
||||
app.conf.worker_disable_rate_limits = True
|
||||
|
||||
# 结果过期时间
|
||||
app.conf.result_expires = 3600 # 任务结果保留1小时
|
||||
app.conf.result_expires = 3600 # 任务结果保留1小时
|
||||
|
||||
Reference in New Issue
Block a user