summary refs log tree commit diff
path: root/synapse/storage/databases
diff options
context:
space:
mode:
authorPatrick Cloke <clokep@users.noreply.github.com>2022-05-25 07:49:54 -0400
committerGitHub <noreply@github.com>2022-05-25 07:49:54 -0400
commit759f9c09e1b2019b772f6baf6a40e74f79df9017 (patch)
tree9e31fa52a37a79f077785445d64f4497395a8433 /synapse/storage/databases
parentMisc clean-up of push rules datastore (#12856) (diff)
downloadsynapse-759f9c09e1b2019b772f6baf6a40e74f79df9017.tar.xz
Fix caching behavior for relations push rules. (#12859)
By always returning all requested values from the function
wrapped by cachedList. Otherwise implicit None values get
added into the cache, which are unexpected.
Diffstat (limited to 'synapse/storage/databases')
-rw-r--r--synapse/storage/databases/main/relations.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/synapse/storage/databases/main/relations.py b/synapse/storage/databases/main/relations.py
index 3b1b2ce6cb..b457bc189e 100644
--- a/synapse/storage/databases/main/relations.py
+++ b/synapse/storage/databases/main/relations.py
@@ -13,7 +13,6 @@
 # limitations under the License.
 
 import logging
-from collections import defaultdict
 from typing import (
     Collection,
     Dict,
@@ -810,7 +809,9 @@ class RelationsWorkerStore(SQLBaseStore):
             txn: LoggingTransaction,
         ) -> Dict[str, Set[Tuple[str, str]]]:
             txn.execute(sql, [event_id] + rel_type_args)
-            result = defaultdict(set)
+            result: Dict[str, Set[Tuple[str, str]]] = {
+                rel_type: set() for rel_type in relation_types
+            }
             for rel_type, sender, type in txn.fetchall():
                 result[rel_type].add((sender, type))
             return result