🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
fix: instantiate the ratelimit redis client on first use to avoid connection errors (#5362)
Steffen Schmitz016993c117bd
diff --git a/web/src/features/public-api/server/RateLimitService.ts b/web/src/features/public-api/server/RateLimitService.tsindex 3c8674ad9b..c5d4a51f1f 100644--- a/web/src/features/public-api/server/RateLimitService.ts+++ b/web/src/features/public-api/server/RateLimitService.ts@@ -34,6 +34,7 @@ export class RateLimitService {createNewRedisInstance({enableAutoPipelining: false, // This may help avoid https://github.com/redis/ioredis/issues/1931enableOfflineQueue: false,+ lazyConnect: true, // Connect when first command is sent...redisQueueRetryOptions,});RateLimitService.instance = new RateLimitService();@@ -83,6 +84,15 @@ export class RateLimitService {return;}+ // Connect Redis if not initialized+ if (RateLimitService?.redis?.status !== "ready") {+ try {+ await RateLimitService?.redis?.connect();+ } catch (err) {+ // Do nothing here. We will fail open if Redis is not available.+ }+ }+const rateLimiter = new RateLimiterRedis({// Basic optionspoints: effectiveConfig.points, // Number of points