浏览代码

推送开关接口删除推送redis缓存

locky 11 月之前
父节点
当前提交
88fa4c0760
共有 2 个文件被更改,包括 3 次插入3 次删除
  1. 1 1
      Controller/DetectControllerV2.py
  2. 2 2
      Object/RedisObject.py

+ 1 - 1
Controller/DetectControllerV2.py

@@ -306,7 +306,7 @@ class DetectControllerViewV2(View):
 
     def do_delete_redis(self, uid, detect_interval=0):
         keyPattern = '{uid}*'.format(uid=uid)
-        redisObj = RedisObject()
+        redisObj = RedisObject(host=PUSH_REDIS_ADDRESS)
         keys = redisObj.get_keys(keyPattern)
         if keys:
             for key in keys:

+ 2 - 2
Object/RedisObject.py

@@ -8,8 +8,8 @@ from Ansjer.config import SERVER_HOST
 
 class RedisObject:
 
-    def __init__(self, db=0):
-        self.POOL = redis.ConnectionPool(host=SERVER_HOST, port=6379, db=db)
+    def __init__(self, db=0, host=SERVER_HOST):
+        self.POOL = redis.ConnectionPool(host=host, port=6379, db=db)
         self.CONN = redis.Redis(connection_pool=self.POOL)
 
     def set_data(self, key, val, expire=0):