From afb0fd609bc9fa10aff4ef30385e4fb4f8c26a78 Mon Sep 17 00:00:00 2001 From: Conrad Irwin Date: Wed, 26 Feb 2025 12:38:16 -0700 Subject: [PATCH] Chunk git status entries (#25627) Prevents us trying to write 5M untracked files to postgres in one commit Release Notes: - N/A *or* Added/Fixed/Improved ... --- crates/proto/Cargo.toml | 1 - crates/proto/src/proto.rs | 56 +++++++++++++++++++++++---------------- 2 files changed, 33 insertions(+), 24 deletions(-) diff --git a/crates/proto/Cargo.toml b/crates/proto/Cargo.toml index 9af37d9eb2ecda..5cb898d7fb2cb9 100644 --- a/crates/proto/Cargo.toml +++ b/crates/proto/Cargo.toml @@ -18,7 +18,6 @@ doctest = false [dependencies] anyhow.workspace = true -collections.workspace = true prost.workspace = true serde.workspace = true diff --git a/crates/proto/src/proto.rs b/crates/proto/src/proto.rs index 13c5229ec3f094..d3384ea1208d5b 100644 --- a/crates/proto/src/proto.rs +++ b/crates/proto/src/proto.rs @@ -7,7 +7,6 @@ mod typed_envelope; pub use error::*; pub use typed_envelope::*; -use collections::HashMap; pub use prost::{DecodeError, Message}; use serde::Serialize; use std::{ @@ -746,16 +745,10 @@ pub const MAX_WORKTREE_UPDATE_MAX_CHUNK_SIZE: usize = 2; pub const MAX_WORKTREE_UPDATE_MAX_CHUNK_SIZE: usize = 256; pub fn split_worktree_update(mut message: UpdateWorktree) -> impl Iterator { - let mut done_files = false; - - let mut repository_map = message - .updated_repositories - .into_iter() - .map(|repo| (repo.work_directory_id, repo)) - .collect::>(); + let mut done = false; iter::from_fn(move || { - if done_files { + if done { return None; } @@ -777,28 +770,45 @@ pub fn split_worktree_update(mut message: UpdateWorktree) -> impl Iterator impl Iterator