SSH Remoting: Fix bugs in worktree syncing (#18406)

Release Notes:

- N/A

---------

Co-authored-by: conrad <conrad@zed.dev>
This commit is contained in:
Mikayla Maki 2024-09-26 12:03:57 -07:00 committed by GitHub
parent 11058765be
commit 71da81c743
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 157 additions and 92 deletions

View file

@ -1826,10 +1826,13 @@ impl RemoteWorktree {
let initial_update = self
.snapshot
.build_initial_update(project_id, self.id().to_proto());
self.updates_tx = Some(tx);
self.update_observer = Some(tx);
cx.spawn(|this, mut cx| async move {
let mut update = initial_update;
loop {
// SSH projects use a special project ID of 0, and we need to
// remap it to the correct one here.
update.project_id = project_id;
if !callback(update).await {
break;
}
@ -1841,7 +1844,7 @@ impl RemoteWorktree {
}
this.update(&mut cx, |this, _| {
let this = this.as_remote_mut().unwrap();
this.updates_tx.take();
this.update_observer.take();
})
})
.detach();