mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-24 04:10:15 +01:00
🌐 feat: Configurable Redis Cluster Mode with Single URI Support (#9039)
* ✨ feat: Add support for enabling Redis cluster configuration * ✨ feat: Enhance Redis client initialization to support cluster configuration without multiple URIs * ✨ feat: Add tests for USE_REDIS_CLUSTER configuration and validation * 🐞 fix: Remove unnecessary blank line in cacheConfig tests
This commit is contained in:
parent
ad1503abdc
commit
9b6395d955
3 changed files with 37 additions and 3 deletions
4
api/cache/redisClients.js
vendored
4
api/cache/redisClients.js
vendored
|
|
@ -48,7 +48,7 @@ if (cacheConfig.USE_REDIS) {
|
|||
};
|
||||
|
||||
ioredisClient =
|
||||
urls.length === 1
|
||||
urls.length === 1 && !cacheConfig.USE_REDIS_CLUSTER
|
||||
? new IoRedis(cacheConfig.REDIS_URI, redisOptions)
|
||||
: new IoRedis.Cluster(
|
||||
urls.map((url) => ({ host: url.hostname, port: parseInt(url.port, 10) || 6379 })),
|
||||
|
|
@ -148,7 +148,7 @@ if (cacheConfig.USE_REDIS) {
|
|||
};
|
||||
|
||||
keyvRedisClient =
|
||||
urls.length === 1
|
||||
urls.length === 1 && !cacheConfig.USE_REDIS_CLUSTER
|
||||
? createClient({ url: cacheConfig.REDIS_URI, ...redisOptions })
|
||||
: createCluster({
|
||||
rootNodes: urls.map((url) => ({ url: url.href })),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue