Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Add some measure blocks to persist_events #3590

Merged
merged 3 commits into from
Jul 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/3590.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add some measure blocks to persist_events
32 changes: 21 additions & 11 deletions synapse/storage/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,19 +417,29 @@ def _persist_events(self, events_and_contexts, backfilled=False,
logger.info(
"Calculating state delta for room %s", room_id,
)
current_state = yield self._get_new_state_after_events(
room_id,
ev_ctx_rm,
latest_event_ids,
new_latest_event_ids,
)

with Measure(
self._clock,
"persist_events.get_new_state_after_events",
):
current_state = yield self._get_new_state_after_events(
room_id,
ev_ctx_rm,
latest_event_ids,
new_latest_event_ids,
)

if current_state is not None:
current_state_for_room[room_id] = current_state
delta = yield self._calculate_state_delta(
room_id, current_state,
)
if delta is not None:
state_delta_for_room[room_id] = delta
with Measure(
self._clock,
"persist_events.calculate_state_delta",
):
delta = yield self._calculate_state_delta(
room_id, current_state,
)
if delta is not None:
state_delta_for_room[room_id] = delta

yield self.runInteraction(
"persist_events",
Expand Down