Don't apply cache factor to event cache. (#7578)

This is already correctly done when we instansiate the cache, but wasn't
when it got reloaded (which always happens at least once on startup).
This commit is contained in:
Erik Johnston 2020-05-27 12:04:37 +01:00 committed by GitHub
parent 9bac5d62b3
commit eefc6b3a0d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 0 deletions

View file

@ -81,6 +81,7 @@ class LruCache(object):
"""
cache = cache_type()
self.cache = cache # Used for introspection.
self.apply_cache_factor_from_config = apply_cache_factor_from_config
# Save the original max size, and apply the default size factor.
self._original_max_size = max_size
@ -294,6 +295,9 @@ class LruCache(object):
Returns:
bool: Whether the cache changed size or not.
"""
if not self.apply_cache_factor_from_config:
return False
new_size = int(self._original_max_size * factor)
if new_size != self.max_size:
self.max_size = new_size