mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-07 20:39:04 +03:00
Merge pull request #1225 from zed-industries/fix-randomized-test-failure
Don't wait for host's worktree updates if they disconnected
This commit is contained in:
commit
c0a434fe27
@ -230,11 +230,6 @@ impl UserStore {
|
||||
Task::ready(Ok(()))
|
||||
}
|
||||
UpdateContacts::Update(message) => {
|
||||
log::info!(
|
||||
"update contacts on client {}: {:?}",
|
||||
self.client.upgrade().unwrap().id,
|
||||
message
|
||||
);
|
||||
let mut user_ids = HashSet::default();
|
||||
for contact in &message.contacts {
|
||||
user_ids.insert(contact.user_id);
|
||||
|
@ -1343,6 +1343,15 @@ impl Project {
|
||||
{
|
||||
*sharing_has_stopped = true;
|
||||
self.collaborators.clear();
|
||||
for worktree in &self.worktrees {
|
||||
if let Some(worktree) = worktree.upgrade(cx) {
|
||||
worktree.update(cx, |worktree, _| {
|
||||
if let Some(worktree) = worktree.as_remote_mut() {
|
||||
worktree.disconnected_from_host();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
cx.notify();
|
||||
}
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ pub struct RemoteWorktree {
|
||||
pub(crate) background_snapshot: Arc<Mutex<Snapshot>>,
|
||||
project_id: u64,
|
||||
client: Arc<Client>,
|
||||
updates_tx: UnboundedSender<proto::UpdateWorktree>,
|
||||
updates_tx: Option<UnboundedSender<proto::UpdateWorktree>>,
|
||||
last_scan_id_rx: watch::Receiver<usize>,
|
||||
replica_id: ReplicaId,
|
||||
diagnostic_summaries: TreeMap<PathKey, DiagnosticSummary>,
|
||||
@ -202,7 +202,7 @@ impl Worktree {
|
||||
replica_id,
|
||||
snapshot: snapshot.clone(),
|
||||
background_snapshot: background_snapshot.clone(),
|
||||
updates_tx,
|
||||
updates_tx: Some(updates_tx),
|
||||
last_scan_id_rx,
|
||||
client: client.clone(),
|
||||
diagnostic_summaries: TreeMap::from_ordered_entries(
|
||||
@ -1042,13 +1042,19 @@ impl RemoteWorktree {
|
||||
self.snapshot.clone()
|
||||
}
|
||||
|
||||
pub fn disconnected_from_host(&mut self) {
|
||||
self.updates_tx.take();
|
||||
}
|
||||
|
||||
pub fn update_from_remote(
|
||||
&mut self,
|
||||
envelope: TypedEnvelope<proto::UpdateWorktree>,
|
||||
) -> Result<()> {
|
||||
self.updates_tx
|
||||
.unbounded_send(envelope.payload)
|
||||
.expect("consumer runs to completion");
|
||||
if let Some(updates_tx) = &self.updates_tx {
|
||||
updates_tx
|
||||
.unbounded_send(envelope.payload)
|
||||
.expect("consumer runs to completion");
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user