Explorar el Código

还原连接方式

locky hace 1 año
padre
commit
f255b58739
Se han modificado 1 ficheros con 2 adiciones y 4 borrados
  1. 2 4
      Object/RedisObject.py

+ 2 - 4
Object/RedisObject.py

@@ -1,7 +1,6 @@
 import redis
 import rediscluster
 from rediscluster import ClusterConnectionPool
-from rediscluster import RedisCluster
 from AnsjerPush.config import REDIS_ADDRESS, CONFIG_INFO, CONFIG_US
 
 # 本地调试把注释打开
@@ -13,9 +12,8 @@ class RedisObject:
     def __init__(self, db=0):
         if CONFIG_INFO == CONFIG_US:
             from AnsjerPush.config import STARTUP_NODES, REDIS_PASSWORD
-            # pool = ClusterConnectionPool(startup_nodes=STARTUP_NODES, password=REDIS_PASSWORD, max_connections=100)
-            # self.CONN = rediscluster.RedisCluster(connection_pool=pool)
-            self.CONN = RedisCluster(startup_nodes=STARTUP_NODES, decode_responses=True, password=REDIS_PASSWORD)
+            pool = ClusterConnectionPool(startup_nodes=STARTUP_NODES, password=REDIS_PASSWORD, max_connections=100)
+            self.CONN = rediscluster.RedisCluster(connection_pool=pool)
         else:
             pool = redis.ConnectionPool(host=REDIS_ADDRESS, port=6379, db=db)
             self.CONN = redis.Redis(connection_pool=pool)