mirror of
https://github.com/langgenius/dify.git
synced 2024-11-15 19:22:36 +08:00
Fix the issues with #9538
Signed-off-by: root <root@localhost.localdomain>
This commit is contained in:
parent
808862a55f
commit
198f2be1a5
|
@ -74,10 +74,11 @@ def init_app(app):
|
|||
redis_client.initialize(master)
|
||||
elif dify_config.REDIS_USE_CLUSTERS:
|
||||
startup_nodes = [
|
||||
{"host": node.split(":")[0], "port": int(node.split(":")[1])} for node in dify_config.REDIS_CLUSTERS.split(",")
|
||||
{"host": node.split(":")[0], "port": int(node.split(":")[1])}
|
||||
for node in dify_config.REDIS_CLUSTERS.split(",")
|
||||
]
|
||||
nodes = [ClusterNode(host=node["host"], port=node["port"]) for node in startup_nodes]
|
||||
redis_client.initialize(RedisCluster(startup_nodes=nodes,password=dify_config.REDIS_CLUSTERS_PASSWORD))
|
||||
redis_client.initialize(RedisCluster(startup_nodes=nodes, password=dify_config.REDIS_CLUSTERS_PASSWORD))
|
||||
else:
|
||||
redis_params.update(
|
||||
{
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
from unittest.mock import MagicMock
|
||||
|
||||
import pytest
|
||||
import redis
|
||||
from api.extensions.ext_redis import RedisClientWrapper
|
||||
|
||||
from core.entities.provider_entities import ModelLoadBalancingConfiguration
|
||||
from core.model_manager import LBModelManager
|
||||
|
@ -55,6 +57,10 @@ def test_lb_model_manager_fetch_next(mocker, lb_model_manager):
|
|||
start_index += 1
|
||||
return start_index
|
||||
|
||||
fake_redis_client = redis.Redis(host="localhost", port=6379, db=0)
|
||||
redis_client = RedisClientWrapper()
|
||||
redis_client.initialize(fake_redis_client)
|
||||
|
||||
mocker.patch("redis.Redis.incr", side_effect=incr)
|
||||
mocker.patch("redis.Redis.set", return_value=None)
|
||||
mocker.patch("redis.Redis.expire", return_value=None)
|
||||
|
|
Loading…
Reference in New Issue
Block a user