浏览代码

优化定时任务

peng 1 年之前
父节点
当前提交
8520a71f05
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      Controller/SensorGateway/SmartSwitchController.py

+ 3 - 0
Controller/SensorGateway/SmartSwitchController.py

@@ -486,6 +486,9 @@ class SmartSwitchView(View):
                         redis_obj.set_hash_data(key, redis_dict)
                         redis_obj.set_persist(key)
                         return response.json(0, redis_dict)
+                timer_exist = redis_obj.get_all_hash_data(key)
+                if timer_exist:
+                    return response.json(174)
                 redis_obj.set_hash_data(key, redis_dict)
                 redis_obj.set_expire(key, countdown_time)
                 msg = {'device_switch': actions, 'task_id': task_id}