Skip to content

Commit

Permalink
remove fallback cache type when failed to connect to redis
Browse files Browse the repository at this point in the history
  • Loading branch information
zzzming committed Jul 8, 2024
1 parent a4fda8a commit 7624f28
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/backend/base/langflow/services/cache/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ def create(self, settings_service: "SettingsService"):
if redis_cache.is_connected():
logger.debug("Redis cache is connected")
return redis_cache
logger.warning("Redis cache is not connected, falling back to in-memory cache")
return AsyncInMemoryCache(expiration_time=settings_service.settings.redis_cache_expire)
else:
# do not attempt to fallback to another cache type
raise ConnectionError("Failed to connect to Redis cache")

elif settings_service.settings.cache_type == "memory":
return ThreadingInMemoryCache(expiration_time=settings_service.settings.cache_expire)
Expand Down

0 comments on commit 7624f28

Please sign in to comment.