summary refs log tree commit diff
path: root/synapse/storage
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2023-02-14 12:10:29 +0100
committerGitHub <noreply@github.com>2023-02-14 11:10:29 +0000
commitf09db5c9918b6aaeb1f53ab4fac3a7f05f512c5f (patch)
tree36d2e71312544cd78eb7001cec4921b710c39570 /synapse/storage
parentChange collection[str] to StrCollection in event_auth code (#14929) (diff)
downloadsynapse-f09db5c9918b6aaeb1f53ab4fac3a7f05f512c5f.tar.xz
Skip calculating unread push actions in `/sync` when `enable_push` is false. (#14980)
Diffstat (limited to 'synapse/storage')
-rw-r--r--synapse/storage/databases/main/event_push_actions.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/synapse/storage/databases/main/event_push_actions.py b/synapse/storage/databases/main/event_push_actions.py
index 3a0c370fde..eeccf5db24 100644
--- a/synapse/storage/databases/main/event_push_actions.py
+++ b/synapse/storage/databases/main/event_push_actions.py
@@ -203,11 +203,18 @@ class RoomNotifCounts:
     # Map of thread ID to the notification counts.
     threads: Dict[str, NotifCounts]
 
+    @staticmethod
+    def empty() -> "RoomNotifCounts":
+        return _EMPTY_ROOM_NOTIF_COUNTS
+
     def __len__(self) -> int:
         # To properly account for the amount of space in any caches.
         return len(self.threads) + 1
 
 
+_EMPTY_ROOM_NOTIF_COUNTS = RoomNotifCounts(NotifCounts(), {})
+
+
 def _serialize_action(
     actions: Collection[Union[Mapping, str]], is_highlight: bool
 ) -> str: