|
@@ -62,18 +62,8 @@ class CeleryBeatObj:
|
|
|
time_stamp = CommonService.convert_to_timestamp(timezone_offset, time_string)
|
|
|
# 时间戳转为东八区的时间字符串
|
|
|
clocked_time = CommonService.get_date_from_timestamp(time_stamp, 8)
|
|
|
- periodic_task = PeriodicTask.objects.filter(name=name)
|
|
|
- if periodic_task.exists():
|
|
|
- periodic_task_qs = periodic_task[0]
|
|
|
- clocked_id = periodic_task_qs.clocked_id
|
|
|
- ClockedSchedule.objects.filter(id=clocked_id).update(clocked_time=clocked_time)
|
|
|
- periodic_task_qs.task = task
|
|
|
- periodic_task_qs.args = args
|
|
|
- periodic_task_qs.kwargs = kwargs
|
|
|
- periodic_task_qs.save()
|
|
|
- else:
|
|
|
- schedule, _ = ClockedSchedule.objects.get_or_create(clocked_time=clocked_time)
|
|
|
- PeriodicTask.objects.create(clocked=schedule, one_off=True, name=name, task=task, args=args, kwargs=kwargs)
|
|
|
+ schedule, _ = ClockedSchedule.objects.get_or_create(clocked_time=clocked_time)
|
|
|
+ PeriodicTask.objects.create(clocked=schedule, one_off=True, name=name, task=task, args=args, kwargs=kwargs)
|
|
|
|
|
|
@staticmethod
|
|
|
def creat_crontab_task(
|