From a7387cae2ca9d5e114246e6fada98bfe7808e1d0 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Fri, 12 Feb 2021 15:58:29 +0100 Subject: Fix slow tests sometimes failing In some situations we reloaded the workspace in the tests after having reported to be ready. There's two fixes here: 1. Add a version to the VFS config and include that version in progress reports, so that we don't think we're done prematurely; 2. Delay status transitions until after changes are applied. Otherwise the last change during loading can potentially trigger a workspace reload, if it contains interesting changes. --- crates/vfs-notify/src/lib.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'crates/vfs-notify') diff --git a/crates/vfs-notify/src/lib.rs b/crates/vfs-notify/src/lib.rs index c605bcf3c..f7ae0577d 100644 --- a/crates/vfs-notify/src/lib.rs +++ b/crates/vfs-notify/src/lib.rs @@ -86,8 +86,10 @@ impl NotifyActor { self.watcher = watcher.map(|it| (it, watcher_receiver)); } + let config_version = config.version; + let n_total = config.load.len(); - self.send(loader::Message::Progress { n_total, n_done: 0 }); + self.send(loader::Message::Progress { n_total, n_done: 0, config_version }); self.watched_entries.clear(); @@ -98,7 +100,11 @@ impl NotifyActor { } let files = self.load_entry(entry, watch); self.send(loader::Message::Loaded { files }); - self.send(loader::Message::Progress { n_total, n_done: i + 1 }); + self.send(loader::Message::Progress { + n_total, + n_done: i + 1, + config_version, + }); } } Message::Invalidate(path) => { -- cgit v1.2.3