Skip to content

Commit 0fd90ad

Browse files
committed
fix(diagnostics): prevent startup request deadlocks
1 parent e242f44 commit 0fd90ad

10 files changed

Lines changed: 1322 additions & 257 deletions

File tree

crates/vfs/src/loader.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,18 @@ pub struct Config {
4444
/// Messages sent by a loader generation back to the main loop.
4545
pub enum Message {
4646
Progress { n_total: usize, n_done: usize, config_version: u32 },
47-
Loaded { files: Vec<(AbsPathBuf, LoadResult)>, config_version: u32 },
47+
Loaded { files: Vec<(AbsPathBuf, LoadResult)>, config_version: u32, origin: LoadOrigin },
48+
}
49+
50+
/// The boundary that caused a batch of file contents to be loaded.
51+
///
52+
/// Keeping this explicit prevents an initial configuration scan from being
53+
/// mistaken for an external file-system change by downstream consumers.
54+
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
55+
pub enum LoadOrigin {
56+
ConfigScan,
57+
ExplicitInvalidate,
58+
FileWatcher,
4859
}
4960

5061
pub type Sender = crossbeam_channel::Sender<Message>;
@@ -126,10 +137,11 @@ impl Directories {
126137
impl fmt::Debug for Message {
127138
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
128139
match self {
129-
Message::Loaded { files, config_version } => f
140+
Message::Loaded { files, config_version, origin } => f
130141
.debug_struct("Loaded")
131142
.field("n_files", &files.len())
132143
.field("config_version", config_version)
144+
.field("origin", origin)
133145
.finish(),
134146
Message::Progress { n_total, n_done, config_version } => f
135147
.debug_struct("Progress")

0 commit comments

Comments
 (0)