mirror of
https://github.com/element-hq/synapse.git
synced 2026-10-23 00:03:16 +00:00
Disable partial state group caching for wildcard lookups
When _get_state_for_groups is given a wildcard filter, just do a complete lookup. Hopefully this will give us the best of both worlds by not filling up the ram if we only need one or two keys, but also making the cache still work for the federation reader usecase.
This commit is contained in:
1 parent
240f192523
commit
43e02c409d
3 files changed
+61
-32
No files matched your search
@@ -32,7 +32,7 @@ class DictCacheTestCase(unittest.TestCase):
|
||||
|
||||
seq = self.cache.sequence
|
||||
test_value = {"test": "test_simple_cache_hit_full"}
|
||||
self.cache.update(seq, key, test_value, full=True)
|
||||
self.cache.update(seq, key, test_value)
|
||||
|
||||
c = self.cache.get(key)
|
||||
self.assertEqual(test_value, c.value)
|
||||
@@ -44,7 +44,7 @@ class DictCacheTestCase(unittest.TestCase):
|
||||
test_value = {
|
||||
"test": "test_simple_cache_hit_partial"
|
||||
}
|
||||
self.cache.update(seq, key, test_value, full=True)
|
||||
self.cache.update(seq, key, test_value)
|
||||
|
||||
c = self.cache.get(key, ["test"])
|
||||
self.assertEqual(test_value, c.value)
|
||||
@@ -56,7 +56,7 @@ class DictCacheTestCase(unittest.TestCase):
|
||||
test_value = {
|
||||
"test": "test_simple_cache_miss_partial"
|
||||
}
|
||||
self.cache.update(seq, key, test_value, full=True)
|
||||
self.cache.update(seq, key, test_value)
|
||||
|
||||
c = self.cache.get(key, ["test2"])
|
||||
self.assertEqual({}, c.value)
|
||||
@@ -70,7 +70,7 @@ class DictCacheTestCase(unittest.TestCase):
|
||||
"test2": "test_simple_cache_hit_miss_partial2",
|
||||
"test3": "test_simple_cache_hit_miss_partial3",
|
||||
}
|
||||
self.cache.update(seq, key, test_value, full=True)
|
||||
self.cache.update(seq, key, test_value)
|
||||
|
||||
c = self.cache.get(key, ["test2"])
|
||||
self.assertEqual({"test2": "test_simple_cache_hit_miss_partial2"}, c.value)
|
||||
@@ -82,13 +82,13 @@ class DictCacheTestCase(unittest.TestCase):
|
||||
test_value_1 = {
|
||||
"test": "test_simple_cache_hit_miss_partial",
|
||||
}
|
||||
self.cache.update(seq, key, test_value_1, full=False)
|
||||
self.cache.update(seq, key, test_value_1, fetched_keys=set("test"))
|
||||
|
||||
seq = self.cache.sequence
|
||||
test_value_2 = {
|
||||
"test2": "test_simple_cache_hit_miss_partial2",
|
||||
}
|
||||
self.cache.update(seq, key, test_value_2, full=False)
|
||||
self.cache.update(seq, key, test_value_2, fetched_keys=set("test2"))
|
||||
|
||||
c = self.cache.get(key)
|
||||
self.assertEqual(
|
||||
|
||||
Reference in new issue
Block a user