Respond to join project request before sharing project completes
This ensures the guest doesn't observe a huge delay when joining.
This commit is contained in:
parent
09bb3ddeb8
commit
845c79ee05
2 changed files with 6 additions and 7 deletions
|
@ -1332,12 +1332,13 @@ impl Project {
|
||||||
let client = self.client.clone();
|
let client = self.client.clone();
|
||||||
cx.foreground()
|
cx.foreground()
|
||||||
.spawn(async move {
|
.spawn(async move {
|
||||||
share.await?;
|
|
||||||
client.send(proto::RespondToJoinProjectRequest {
|
client.send(proto::RespondToJoinProjectRequest {
|
||||||
requester_id,
|
requester_id,
|
||||||
project_id,
|
project_id,
|
||||||
allow,
|
allow,
|
||||||
})
|
})?;
|
||||||
|
share.await?;
|
||||||
|
anyhow::Ok(())
|
||||||
})
|
})
|
||||||
.detach_and_log_err(cx);
|
.detach_and_log_err(cx);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2718,10 +2718,11 @@ async fn send_worktree_update(
|
||||||
#[cfg(not(any(test, feature = "test-support")))]
|
#[cfg(not(any(test, feature = "test-support")))]
|
||||||
const MAX_CHUNK_SIZE: usize = 256;
|
const MAX_CHUNK_SIZE: usize = 256;
|
||||||
|
|
||||||
loop {
|
let mut is_last_update = false;
|
||||||
|
while !is_last_update {
|
||||||
let chunk_size = cmp::min(update.updated_entries.len(), MAX_CHUNK_SIZE);
|
let chunk_size = cmp::min(update.updated_entries.len(), MAX_CHUNK_SIZE);
|
||||||
let updated_entries = update.updated_entries.drain(..chunk_size).collect();
|
let updated_entries = update.updated_entries.drain(..chunk_size).collect();
|
||||||
let is_last_update = update.updated_entries.is_empty();
|
is_last_update = update.updated_entries.is_empty();
|
||||||
client
|
client
|
||||||
.request(proto::UpdateWorktree {
|
.request(proto::UpdateWorktree {
|
||||||
project_id: update.project_id,
|
project_id: update.project_id,
|
||||||
|
@ -2733,9 +2734,6 @@ async fn send_worktree_update(
|
||||||
is_last_update,
|
is_last_update,
|
||||||
})
|
})
|
||||||
.await?;
|
.await?;
|
||||||
if is_last_update {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue