Browse Source

更新设备影子加锁

linhaohong 1 năm trước cách đây
mục cha
commit
7a9ca47cd0
1 tập tin đã thay đổi với 1 bổ sung1 xóa
  1. 1 1
      Controller/ShadowController.py

+ 1 - 1
Controller/ShadowController.py

@@ -74,7 +74,7 @@ def update_device_shadow(request):
             update_ip_info(ip, uid)
         else:
             redis_key = f"DEVICE:UPDATE:SHADOW:{uid}"
-            is_lock = redis_obj.CONN.set(redis_key, nx=True, ex=60)
+            is_lock = redis_obj.CONN.set(redis_key, value=1, nx=True, ex=60)
             if not is_lock:
                 return JsonResponse(status=200, data={'code': 5, 'msg': 'Please try again one minute later!',
                                                       'data': {}})