apply to sentinel and cluster mode

pull/19493/head
Bowen Liang 1 year ago
parent 9170ed9e1e
commit 0dfdd71467

@ -60,6 +60,7 @@ def init_app(app: DifyApp):
"encoding": "utf-8", "encoding": "utf-8",
"encoding_errors": "strict", "encoding_errors": "strict",
"decode_responses": False, "decode_responses": False,
"cache_config": CacheConfig(),
} }
if dify_config.REDIS_USE_SENTINEL: if dify_config.REDIS_USE_SENTINEL:
@ -83,8 +84,13 @@ def init_app(app: DifyApp):
ClusterNode(host=node.split(":")[0], port=int(node.split(":")[1])) ClusterNode(host=node.split(":")[0], port=int(node.split(":")[1]))
for node in dify_config.REDIS_CLUSTERS.split(",") for node in dify_config.REDIS_CLUSTERS.split(",")
] ]
# FIXME: mypy error here, try to figure out how to fix it redis_client.initialize(
redis_client.initialize(RedisCluster(startup_nodes=nodes, password=dify_config.REDIS_CLUSTERS_PASSWORD)) # type: ignore RedisCluster(
startup_nodes=nodes,
password=dify_config.REDIS_CLUSTERS_PASSWORD,
cache_config=CacheConfig(),
)
)
else: else:
redis_params.update( redis_params.update(
{ {

Loading…
Cancel
Save