mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-04 10:14:49 -04:00
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:
parent
9bac5d62b3
commit
eefc6b3a0d
3 changed files with 21 additions and 0 deletions
|
@ -125,3 +125,19 @@ class CacheConfigTests(TestCase):
|
|||
cache = LruCache(100)
|
||||
add_resizable_cache("foo", cache_resize_callback=cache.set_cache_factor)
|
||||
self.assertEqual(cache.max_size, 150)
|
||||
|
||||
def test_apply_cache_factor_from_config(self):
|
||||
"""Caches can disable applying cache factor updates, mainly used by
|
||||
event cache size.
|
||||
"""
|
||||
|
||||
config = {"caches": {"event_cache_size": "10k"}}
|
||||
t = TestConfig()
|
||||
t.read_config(config, config_dir_path="", data_dir_path="")
|
||||
|
||||
cache = LruCache(
|
||||
max_size=t.caches.event_cache_size, apply_cache_factor_from_config=False,
|
||||
)
|
||||
add_resizable_cache("event_cache", cache_resize_callback=cache.set_cache_factor)
|
||||
|
||||
self.assertEqual(cache.max_size, 10240)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue