perf: ansible任务 未激活的时候关闭定时任务 (#11631)

Co-authored-by: feng <1304903146@qq.com>
pull/11633/head
fit2bot 1 year ago committed by GitHub
parent 39baf88055
commit a51549cf1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -48,7 +48,8 @@ class PeriodTaskModelMixin(models.Model):
def set_period_schedule(self): def set_period_schedule(self):
name, task, args, kwargs = self.get_register_task() name, task, args, kwargs = self.get_register_task()
if not self.is_periodic: is_active = self.is_active if hasattr(self, 'is_active') else True
if not self.is_periodic or not is_active:
disable_celery_periodic_task(name) disable_celery_periodic_task(name)
return return

Loading…
Cancel
Save