add corks to coalesce writes for several heavy calltrees.

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-03-21 04:13:08 -07:00 committed by June
parent 3f60365cc6
commit 61b1d6d869
3 changed files with 13 additions and 0 deletions

View file

@ -197,6 +197,10 @@ async fn sync_helper(
.extend(services().users.keys_changed(sender_user.as_ref(), since, None).filter_map(std::result::Result::ok));
let all_joined_rooms = services().rooms.state_cache.rooms_joined(&sender_user).collect::<Vec<_>>();
// Coalesce database writes for the remainder of this scope.
let _cork = services().globals.db.cork_and_flush()?;
for room_id in all_joined_rooms {
let room_id = room_id?;
if let Ok(joined_room) = load_joined_room(