Browse Source

fix: 重启服务禁用的定时任务会执行问题

pull/13045/head
wangruidong 7 months ago committed by 老广
parent
commit
ac988a76b4
  1. 4
      apps/ops/celery/signal_handler.py

4
apps/ops/celery/signal_handler.py

@ -26,6 +26,10 @@ def on_app_ready(sender=None, headers=None, **kwargs):
logger.debug("Work ready signal recv")
logger.debug("Start need start task: [{}]".format(", ".join(tasks)))
for task in tasks:
periodic_task = PeriodicTask.objects.filter(task=task).first()
if periodic_task and not periodic_task.enabled:
logger.debug("Periodic task [{}] is disabled!".format(task))
continue
subtask(task).delay()

Loading…
Cancel
Save