禁用除新订单服务号广播外的所有 Celery/Beat 任务,仅保留 dingdan_guangbo
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -15,6 +15,7 @@ from yonghu.models import (
|
||||
UserMain, UserDashou, UserShangjia, UserGuanshi, UserBoss,
|
||||
RankingRecord
|
||||
)
|
||||
from utils.celery_guard import celery_non_broadcast_blocked
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -44,6 +45,11 @@ def zhuanyi_ribang():
|
||||
转移日榜数据 - 每天23:55执行
|
||||
在清零前将今日数据转移到排行榜表
|
||||
"""
|
||||
blocked = celery_non_broadcast_blocked()
|
||||
if blocked:
|
||||
logger.info('跳过 zhuanyi_ribang: %s', blocked)
|
||||
return {"success": True, "message": blocked}
|
||||
|
||||
try:
|
||||
# 统计日期(今天)
|
||||
today = timezone.now().date()
|
||||
@@ -141,6 +147,11 @@ def zhuanyi_yuebang():
|
||||
转移月榜数据 - 每月最后一天23:50执行
|
||||
在清零前将本月数据转移到排行榜表
|
||||
"""
|
||||
blocked = celery_non_broadcast_blocked()
|
||||
if blocked:
|
||||
logger.info('跳过 zhuanyi_yuebang: %s', blocked)
|
||||
return {"success": True, "message": blocked}
|
||||
|
||||
try:
|
||||
# 🔥 获取当前时间
|
||||
now = timezone.now()
|
||||
@@ -258,6 +269,11 @@ def qingli_jiulishuju():
|
||||
清理旧历史数据 - 每月1号凌晨1点执行
|
||||
清理3个月前的排行榜数据,保留最近3个月的数据
|
||||
"""
|
||||
blocked = celery_non_broadcast_blocked()
|
||||
if blocked:
|
||||
logger.info('跳过 qingli_jiulishuju: %s', blocked)
|
||||
return {"success": True, "message": blocked}
|
||||
|
||||
try:
|
||||
# 计算3个月前的日期
|
||||
three_months_ago = timezone.now().date() - timedelta(days=90)
|
||||
|
||||
@@ -14,6 +14,7 @@ import logging
|
||||
# 导入模型
|
||||
from yonghu.models import UserDashou, UserShangjia, UserGuanshi
|
||||
from utils.celery_utils import log_task_execution, rollback_on_failure
|
||||
from utils.celery_guard import celery_non_broadcast_blocked
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -24,6 +25,11 @@ def daily_reset_task():
|
||||
每日清零任务 - 每天凌晨0点执行
|
||||
清零打手、商家、管事的今日相关字段
|
||||
"""
|
||||
blocked = celery_non_broadcast_blocked()
|
||||
if blocked:
|
||||
logger.info('跳过 daily_reset_task: %s', blocked)
|
||||
return {"success": True, "message": blocked}
|
||||
|
||||
try:
|
||||
with transaction.atomic():
|
||||
start_time = timezone.now()
|
||||
@@ -103,6 +109,11 @@ def monthly_reset_task():
|
||||
每月清零任务 - 每月1日凌晨0点执行
|
||||
清零打手、商家、管事的本月相关字段
|
||||
"""
|
||||
blocked = celery_non_broadcast_blocked()
|
||||
if blocked:
|
||||
logger.info('跳过 monthly_reset_task: %s', blocked)
|
||||
return {"success": True, "message": blocked}
|
||||
|
||||
try:
|
||||
with transaction.atomic():
|
||||
start_time = timezone.now()
|
||||
|
||||
Reference in New Issue
Block a user