Don't pull out full state when sending dummy events (#13310)

This commit is contained in:
Erik Johnston 2022-07-18 14:19:11 +01:00 committed by GitHub
parent 6785b0f39d
commit cf5fa5063d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 7 deletions

1
changelog.d/13310.misc Normal file
View File

@ -0,0 +1 @@
Reduce memory usage of sending dummy events.

View File

@ -1849,13 +1849,8 @@ class EventCreationHandler:
# For each room we need to find a joined member we can use to send # For each room we need to find a joined member we can use to send
# the dummy event with. # the dummy event with.
latest_event_ids = await self.store.get_prev_events_for_room(room_id) members = await self.store.get_local_users_in_room(room_id)
members = await self.state.get_current_users_in_room(
room_id, latest_event_ids=latest_event_ids
)
for user_id in members: for user_id in members:
if not self.hs.is_mine_id(user_id):
continue
requester = create_requester(user_id, authenticated_entity=self.server_name) requester = create_requester(user_id, authenticated_entity=self.server_name)
try: try:
event, context = await self.create_event( event, context = await self.create_event(
@ -1866,7 +1861,6 @@ class EventCreationHandler:
"room_id": room_id, "room_id": room_id,
"sender": user_id, "sender": user_id,
}, },
prev_event_ids=latest_event_ids,
) )
event.internal_metadata.proactively_send = False event.internal_metadata.proactively_send = False