mirror of
https://mau.dev/maunium/synapse.git
synced 2024-12-17 09:23:50 +01:00
Move Measure calls into resolve_events_with_store
This commit is contained in:
parent
ba700074c6
commit
8412c08a87
1 changed files with 31 additions and 32 deletions
|
@ -448,7 +448,6 @@ class StateHandler:
|
||||||
|
|
||||||
state_map = {ev.event_id: ev for st in state_sets for ev in st}
|
state_map = {ev.event_id: ev for st in state_sets for ev in st}
|
||||||
|
|
||||||
with Measure(self.clock, "state._resolve_events"):
|
|
||||||
new_state = await self._state_resolution_handler.resolve_events_with_store(
|
new_state = await self._state_resolution_handler.resolve_events_with_store(
|
||||||
event.room_id,
|
event.room_id,
|
||||||
room_version,
|
room_version,
|
||||||
|
@ -529,7 +528,6 @@ class StateResolutionHandler:
|
||||||
|
|
||||||
state_groups_histogram.observe(len(state_groups_ids))
|
state_groups_histogram.observe(len(state_groups_ids))
|
||||||
|
|
||||||
with Measure(self.clock, "state._resolve_events"):
|
|
||||||
new_state = await self.resolve_events_with_store(
|
new_state = await self.resolve_events_with_store(
|
||||||
room_id,
|
room_id,
|
||||||
room_version,
|
room_version,
|
||||||
|
@ -550,14 +548,14 @@ class StateResolutionHandler:
|
||||||
|
|
||||||
return cache
|
return cache
|
||||||
|
|
||||||
def resolve_events_with_store(
|
async def resolve_events_with_store(
|
||||||
self,
|
self,
|
||||||
room_id: str,
|
room_id: str,
|
||||||
room_version: str,
|
room_version: str,
|
||||||
state_sets: Sequence[StateMap[str]],
|
state_sets: Sequence[StateMap[str]],
|
||||||
event_map: Optional[Dict[str, EventBase]],
|
event_map: Optional[Dict[str, EventBase]],
|
||||||
state_res_store: "StateResolutionStore",
|
state_res_store: "StateResolutionStore",
|
||||||
) -> Awaitable[StateMap[str]]:
|
) -> StateMap[str]:
|
||||||
"""
|
"""
|
||||||
Args:
|
Args:
|
||||||
room_id: the room we are working in
|
room_id: the room we are working in
|
||||||
|
@ -580,13 +578,14 @@ class StateResolutionHandler:
|
||||||
Returns:
|
Returns:
|
||||||
a map from (type, state_key) to event_id.
|
a map from (type, state_key) to event_id.
|
||||||
"""
|
"""
|
||||||
|
with Measure(self.clock, "state._resolve_events"):
|
||||||
v = KNOWN_ROOM_VERSIONS[room_version]
|
v = KNOWN_ROOM_VERSIONS[room_version]
|
||||||
if v.state_res == StateResolutionVersions.V1:
|
if v.state_res == StateResolutionVersions.V1:
|
||||||
return v1.resolve_events_with_store(
|
return await v1.resolve_events_with_store(
|
||||||
room_id, state_sets, event_map, state_res_store.get_events
|
room_id, state_sets, event_map, state_res_store.get_events
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
return v2.resolve_events_with_store(
|
return await v2.resolve_events_with_store(
|
||||||
self.clock,
|
self.clock,
|
||||||
room_id,
|
room_id,
|
||||||
room_version,
|
room_version,
|
||||||
|
|
Loading…
Reference in a new issue