|
@@ -1316,7 +1316,8 @@ class SmartSceneView(View):
|
|
@return: task_id
|
|
@return: task_id
|
|
"""
|
|
"""
|
|
celery_beat_obj = CeleryBeatObj()
|
|
celery_beat_obj = CeleryBeatObj()
|
|
- name = serial_number + '_'
|
|
|
|
|
|
+ # 任务名拼接当前时间戳,防止重复
|
|
|
|
+ name = '{}_{}_'.format(serial_number, str(int(time.time())))
|
|
kwargs = {
|
|
kwargs = {
|
|
'device_type': device_type,
|
|
'device_type': device_type,
|
|
'event_type': event_type,
|
|
'event_type': event_type,
|
|
@@ -1425,7 +1426,10 @@ class SmartSceneView(View):
|
|
# 存在任务则删除
|
|
# 存在任务则删除
|
|
task_id = time_task.get('task_id')
|
|
task_id = time_task.get('task_id')
|
|
if task_id:
|
|
if task_id:
|
|
- celery_beat_obj.del_task(task_id)
|
|
|
|
|
|
+ try:
|
|
|
|
+ celery_beat_obj.del_task(task_id)
|
|
|
|
+ except Exception:
|
|
|
|
+ continue
|
|
|
|
|
|
@classmethod
|
|
@classmethod
|
|
def pause_or_resume_job(cls, scene_data_dict, scene_status, scene_id):
|
|
def pause_or_resume_job(cls, scene_data_dict, scene_status, scene_id):
|