From b96962005e6824448f4904f6bca30dc11adaa616 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 30 Jun 2022 09:54:14 +0200 Subject: [PATCH] Keep looking for a newer snapshot before broadcasting it --- crates/project/src/worktree.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/project/src/worktree.rs b/crates/project/src/worktree.rs index 472dacc0ea59e77151b3cf50b16f8c1f58569fee..3afbcb1dd7c60149cc134aea0cc9a54b86d670e0 100644 --- a/crates/project/src/worktree.rs +++ b/crates/project/src/worktree.rs @@ -980,7 +980,11 @@ impl LocalWorktree { } } - while let Ok(snapshot) = snapshots_to_send_rx.recv().await { + while let Ok(mut snapshot) = snapshots_to_send_rx.recv().await { + while let Ok(newer_snapshot) = snapshots_to_send_rx.try_recv() { + snapshot = newer_snapshot; + } + let message = snapshot.build_update(&prev_snapshot, project_id, worktree_id, true); rpc.request(message).await?;