Fix crash in collab when sending worktree updates (#19678)
This pull request does a couple of things: - In29c2df73e1
, we introduced a safety guard that prevents this crash from happening again in the future by returning an error instead of panicking when the payload is too large. - In3e7a2e5c30
, we introduced chunking for updates coming from SSH servers (previously, we were sending the whole changeset and initial set of paths in their entirety). - In122b5b4
, we introduced a panic hook that sends panics to Axiom. For posterity, this is how we figured out what the panic was: ``` kubectl logs current-pod-name --previous --namespace=production ``` Release Notes: - N/A --------- Co-authored-by: Thorsten <thorsten@zed.dev> Co-authored-by: Bennet <bennet@zed.dev> Co-authored-by: Kirill <kirill@zed.dev>
This commit is contained in:
parent
b5aea548a8
commit
499e1459eb
5 changed files with 57 additions and 28 deletions
|
@ -1713,11 +1713,6 @@ fn notify_rejoined_projects(
|
|||
|
||||
for project in rejoined_projects {
|
||||
for worktree in mem::take(&mut project.worktrees) {
|
||||
#[cfg(any(test, feature = "test-support"))]
|
||||
const MAX_CHUNK_SIZE: usize = 2;
|
||||
#[cfg(not(any(test, feature = "test-support")))]
|
||||
const MAX_CHUNK_SIZE: usize = 256;
|
||||
|
||||
// Stream this worktree's entries.
|
||||
let message = proto::UpdateWorktree {
|
||||
project_id: project.id.to_proto(),
|
||||
|
@ -1731,7 +1726,7 @@ fn notify_rejoined_projects(
|
|||
updated_repositories: worktree.updated_repositories,
|
||||
removed_repositories: worktree.removed_repositories,
|
||||
};
|
||||
for update in proto::split_worktree_update(message, MAX_CHUNK_SIZE) {
|
||||
for update in proto::split_worktree_update(message) {
|
||||
session.peer.send(session.connection_id, update.clone())?;
|
||||
}
|
||||
|
||||
|
@ -2195,11 +2190,6 @@ fn join_project_internal(
|
|||
})?;
|
||||
|
||||
for (worktree_id, worktree) in mem::take(&mut project.worktrees) {
|
||||
#[cfg(any(test, feature = "test-support"))]
|
||||
const MAX_CHUNK_SIZE: usize = 2;
|
||||
#[cfg(not(any(test, feature = "test-support")))]
|
||||
const MAX_CHUNK_SIZE: usize = 256;
|
||||
|
||||
// Stream this worktree's entries.
|
||||
let message = proto::UpdateWorktree {
|
||||
project_id: project_id.to_proto(),
|
||||
|
@ -2213,7 +2203,7 @@ fn join_project_internal(
|
|||
updated_repositories: worktree.repository_entries.into_values().collect(),
|
||||
removed_repositories: Default::default(),
|
||||
};
|
||||
for update in proto::split_worktree_update(message, MAX_CHUNK_SIZE) {
|
||||
for update in proto::split_worktree_update(message) {
|
||||
session.peer.send(session.connection_id, update.clone())?;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue