-
Notifications
You must be signed in to change notification settings - Fork 361
Make room upgrades faster for rooms with many bans #18574
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
synapse/handlers/room.py
Outdated
# Add any banned users to the new room | ||
await self.event_creation_handler.create_and_send_new_client_events( | ||
requester=requester, | ||
room_id=new_room_id, | ||
prev_event_id=last_event_id, | ||
event_dicts=[ | ||
{ | ||
"type": EventTypes.Member, | ||
"state_key": ban_event.state_key, | ||
"room_id": new_room_id, | ||
"sender": requester.user.to_string(), | ||
"content": ban_event.content, | ||
} | ||
for ban_event in ban_events | ||
], | ||
ratelimit=False, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of adding our own new create_and_send_new_client_events(...)
method, can we just add all of the bans to _send_events_for_new_room(...)
initial_state
?
It looks like it also makes its way to handle_new_client_event
with bulk events like what create_and_send_new_client_events
does.
Co-authored-by: Eric Eastwood <[email protected]>
This supports sending membership events in very limited circumstances | ||
(namely that the event is valid as is and doesn't need federation | ||
requests or anything). Callers should prefer to use `update_membership`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feels like we should better clarify that general state events are just fine.
synapse/handlers/room.py
Outdated
"sender": requester.user.to_string(), | ||
"content": ban_event.content, | ||
} | ||
for ban_event in ban_events |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a maximum number of events we should be calling with at a time?
We could use batch_iter
We do this by a) not pulling out all membership events, and b) batch inserting bans.
One blocking concern is that this bypasses the
update_membership
function, which otherwise all other membership events go via. In this case it's fine (having audited what it is doing), but I'm hesitant to set the precedent of bypassing it, given it has a lot of logic in there.