Explorar o código

定时删除推送消息,改为3分钟删除一次10万条数据

lang %!s(int64=3) %!d(string=hai) anos
pai
achega
34cba6ec9c
Modificáronse 1 ficheiros con 2 adicións e 2 borrados
  1. 2 2
      Controller/EquipmentInfo.py

+ 2 - 2
Controller/EquipmentInfo.py

@@ -295,8 +295,8 @@ def deleteExpireEquipmentInfo(request):
     import time
     nowTime = int(time.time())
     try:
-        for i in range(5):
-            ei = Equipment_Info.objects.filter(addTime__lte=str(nowTime - 3600 * 24 * 7))[0:10000]
+        for i in range(10):
+            ei = Equipment_Info.objects.filter(eventTime__lte=str(nowTime - 3600 * 24 * 7))[0:10000]
             id_list = list(ei.values_list("id", flat=True))
             Equipment_Info.objects.filter(id__in=id_list).delete()
         return response.json(0)