mirror of
https://github.com/element-hq/synapse.git
synced 2024-12-20 19:10:45 +03:00
TEMPORARY Add more Measure blocks
This commit is contained in:
parent
f3db863420
commit
adfa0fded3
1 changed files with 63 additions and 57 deletions
|
@ -124,7 +124,7 @@ async def resolve_events_with_store(
|
|||
# Also fetch all auth events that appear in only some of the state sets'
|
||||
# auth chains.
|
||||
auth_diff = await _get_auth_chain_difference(
|
||||
room_id, state_sets, event_map, state_res_store
|
||||
room_id, state_sets, event_map, state_res_store, clock
|
||||
)
|
||||
|
||||
with Measure(clock, "rei_state_res:rews2_b"): # TODO temporary (rei)
|
||||
|
@ -284,6 +284,7 @@ async def _get_auth_chain_difference(
|
|||
state_sets: Sequence[StateMap[str]],
|
||||
unpersisted_events: Dict[str, EventBase],
|
||||
state_res_store: StateResolutionStore,
|
||||
clock: Clock,
|
||||
) -> Set[str]:
|
||||
"""Compare the auth chains of each state set and return the set of events
|
||||
that only appear in some, but not all of the auth chains.
|
||||
|
@ -315,6 +316,7 @@ async def _get_auth_chain_difference(
|
|||
# event IDs if they appear in the `unpersisted_events`. This is the intersection of
|
||||
# the event's auth chain with the events in `unpersisted_events` *plus* their
|
||||
# auth event IDs.
|
||||
with Measure(clock, "rei_state_res:rews2_a1"): # TODO temporary (rei)
|
||||
events_to_auth_chain: Dict[str, Set[str]] = {}
|
||||
for event in unpersisted_events.values():
|
||||
chain = {event.event_id}
|
||||
|
@ -333,6 +335,7 @@ async def _get_auth_chain_difference(
|
|||
#
|
||||
# Note: If there are no `unpersisted_events` (which is the common case), we can do a
|
||||
# much simpler calculation.
|
||||
with Measure(clock, "rei_state_res:rews2_a2"): # TODO temporary (rei)
|
||||
if unpersisted_events:
|
||||
# The list of state sets to pass to the store, where each state set is a set
|
||||
# of the event ids making up the state. This is similar to `state_sets`,
|
||||
|
@ -382,9 +385,12 @@ async def _get_auth_chain_difference(
|
|||
auth_difference_unpersisted_part = ()
|
||||
state_sets_ids = [set(state_set.values()) for state_set in state_sets]
|
||||
|
||||
with Measure(clock, "rei_state_res:rews2_a3"): # TODO temporary (rei)
|
||||
difference = await state_res_store.get_auth_chain_difference(
|
||||
room_id, state_sets_ids
|
||||
)
|
||||
|
||||
with Measure(clock, "rei_state_res:rews2_a4"): # TODO temporary (rei)
|
||||
difference.update(auth_difference_unpersisted_part)
|
||||
|
||||
return difference
|
||||
|
|
Loading…
Reference in a new issue