-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: inmemory and async cache expire configurable #2496
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -29,9 +29,9 @@ def create(self, settings_service: "SettingsService"): | |||
logger.debug("Redis cache is connected") | |||
return redis_cache | |||
logger.warning("Redis cache is not connected, falling back to in-memory cache") | |||
return AsyncInMemoryCache() | |||
return AsyncInMemoryCache(expiration_time=settings_service.settings.redis_cache_expire) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return AsyncInMemoryCache(expiration_time=settings_service.settings.redis_cache_expire) | |
return AsyncInMemoryCache(expiration_time=settings_service.settings.cache_expire) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is Redis failure case so that inmemory cache should respect the Redis cache_expire.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you use AsyncInMemoryCache
you're not using redis, therefore you should not use redis parameters.
The expire time is related to the implementation. Mixing the values can be dangerous.
In general I believe the current behaviour is wrong. If you configure to use redis but you messed up some connection config, langflow should stop instead of falling back. - but it's not related to this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. Let's merge this and we'll deactivate the fallback.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the fallback to AsyncCache behaviour since this can be confusing and make it difficult to debug if Redis cannot be connected at the initialization.
inmemory and async cache expire configurable
inmemory and async cache expire configurable (cherry picked from commit f663655)
Make in-memory and async cache expiry time configurable. This is needed for some of our deployment.
This implementation also aligns with Redis cache that allows redis cache expiry to be configurable.