summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--changelog.d/15647.bugfix1
-rw-r--r--synapse/storage/controllers/state.py15
2 files changed, 9 insertions, 7 deletions
diff --git a/changelog.d/15647.bugfix b/changelog.d/15647.bugfix
new file mode 100644
index 0000000000..2eff30f6e3
--- /dev/null
+++ b/changelog.d/15647.bugfix
@@ -0,0 +1 @@
+Instrument `state` and `state_group` storage-related operations to better picture what's happening when tracing.
diff --git a/synapse/storage/controllers/state.py b/synapse/storage/controllers/state.py
index 06a80869eb..7089b0a1d8 100644
--- a/synapse/storage/controllers/state.py
+++ b/synapse/storage/controllers/state.py
@@ -16,7 +16,6 @@ from typing import (
     TYPE_CHECKING,
     AbstractSet,
     Any,
-    Awaitable,
     Callable,
     Collection,
     Dict,
@@ -175,9 +174,9 @@ class StateStorageController:
 
     @trace
     @tag_args
-    def _get_state_groups_from_groups(
+    async def _get_state_groups_from_groups(
         self, groups: List[int], state_filter: StateFilter
-    ) -> Awaitable[Dict[int, StateMap[str]]]:
+    ) -> Dict[int, StateMap[str]]:
         """Returns the state groups for a given set of groups, filtering on
         types of state events.
 
@@ -190,7 +189,9 @@ class StateStorageController:
             Dict of state group to state map.
         """
 
-        return self.stores.state._get_state_groups_from_groups(groups, state_filter)
+        return await self.stores.state._get_state_groups_from_groups(
+            groups, state_filter
+        )
 
     @trace
     @tag_args
@@ -349,9 +350,9 @@ class StateStorageController:
 
     @trace
     @tag_args
-    def get_state_for_groups(
+    async def get_state_for_groups(
         self, groups: Iterable[int], state_filter: Optional[StateFilter] = None
-    ) -> Awaitable[Dict[int, MutableStateMap[str]]]:
+    ) -> Dict[int, MutableStateMap[str]]:
         """Gets the state at each of a list of state groups, optionally
         filtering by type/state_key
 
@@ -363,7 +364,7 @@ class StateStorageController:
         Returns:
             Dict of state group to state map.
         """
-        return self.stores.state._get_state_for_groups(
+        return await self.stores.state._get_state_for_groups(
             groups, state_filter or StateFilter.all()
         )