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

Increase DB/CPU perf of _is_server_still_joined check. #6936

Merged
merged 7 commits into from
Feb 19, 2020

Conversation

erikjohnston
Copy link
Member

For rooms with large amount of state a single user leaving could cause us to go and load a lot of membership events and then pull out membership state in a large number of batches.

For rooms with large amount of state a single user leaving could cause
us to go and load a lot of membership events and then pull out
membership state in a large number of batches.
@erikjohnston erikjohnston force-pushed the erikj/speed_up_is_server_still_joined branch from b2f8ec7 to d7beb16 Compare February 18, 2020 11:50
@erikjohnston erikjohnston changed the base branch from master to develop February 18, 2020 12:02
@erikjohnston erikjohnston requested a review from a team February 18, 2020 12:45
synapse/storage/persist_events.py Outdated Show resolved Hide resolved
synapse/storage/persist_events.py Outdated Show resolved Hide resolved
synapse/storage/data_stores/main/roommember.py Outdated Show resolved Hide resolved
@erikjohnston erikjohnston requested a review from richvdh February 18, 2020 16:52
Copy link
Member

@richvdh richvdh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm otherwise

@@ -736,8 +736,10 @@ def _maybe_start_persisting(self, room_id: str):
if event_id == event.event_id:
if event.membership == Membership.JOIN:
return True
else:
events_to_check.append(event_id)
else:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the obscure else: here is redundant.

Comment on lines 751 to 752
# None of the changes to state are joins, so we fall back to checking
# the current state of the room to see if any of our users are joined
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this needs to die

@erikjohnston erikjohnston merged commit 0d0bc35 into develop Feb 19, 2020
@erikjohnston erikjohnston deleted the erikj/speed_up_is_server_still_joined branch February 19, 2020 10:15
babolivier pushed a commit that referenced this pull request Sep 1, 2021
* commit '0d0bc3579':
  Increase DB/CPU perf of `_is_server_still_joined` check. (#6936)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants