Split worktree updates and only send 256 entries at a time

This commit is contained in:
Antonio Scandurra 2022-06-30 14:06:41 +02:00
parent 5df0a6a425
commit 09bb3ddeb8
5 changed files with 88 additions and 70 deletions

View file

@ -804,6 +804,7 @@ impl Server {
.collect(),
visible: worktree.visible,
scan_id: shared_worktree.scan_id,
is_complete: worktree.is_complete,
})
})
.collect::<Vec<_>>();
@ -963,6 +964,7 @@ impl Server {
&request.payload.removed_entries,
&request.payload.updated_entries,
request.payload.scan_id,
request.payload.is_last_update,
)?;
(connection_ids, metadata_changed, extension_counts.clone())
};

View file

@ -62,6 +62,7 @@ pub struct Worktree {
#[serde(skip)]
pub diagnostic_summaries: BTreeMap<PathBuf, proto::DiagnosticSummary>,
pub scan_id: u64,
pub is_complete: bool,
}
#[derive(Default)]
@ -615,6 +616,7 @@ impl Store {
removed_entries: &[u64],
updated_entries: &[proto::Entry],
scan_id: u64,
is_last_update: bool,
) -> Result<(Vec<ConnectionId>, bool, HashMap<String, usize>)> {
let project = self.write_project(project_id, connection_id)?;
let connection_ids = project.connection_ids();
@ -657,6 +659,7 @@ impl Store {
}
worktree.scan_id = scan_id;
worktree.is_complete = is_last_update;
Ok((
connection_ids,
metadata_changed,