summary refs log tree commit diff
path: root/synapse/util/caches/lrucache.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2020-05-27 12:04:37 +0100
committerGitHub <noreply@github.com>2020-05-27 12:04:37 +0100
commiteefc6b3a0d08cd2a64be7c78c0a4a651cc965be9 (patch)
treeca91c6cf8a1b5639668f68f639c99a1c1ff32b3b /synapse/util/caches/lrucache.py
parentEnsure ReplicationStreamer is always started when replication enabled. (#7579) (diff)
downloadsynapse-eefc6b3a0d08cd2a64be7c78c0a4a651cc965be9.tar.xz
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).
Diffstat (limited to 'synapse/util/caches/lrucache.py')
-rw-r--r--synapse/util/caches/lrucache.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/synapse/util/caches/lrucache.py b/synapse/util/caches/lrucache.py
index 29fabac3cd..df4ea5901d 100644
--- a/synapse/util/caches/lrucache.py
+++ b/synapse/util/caches/lrucache.py
@@ -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