Unverified Commit dfef8c72 authored by vercel[bot]'s avatar vercel[bot] Committed by GitHub

Fix polling watcher subsecond edits

Co-Authored-By: 's avatarMarcos Hernanz <96699542+marcoshernanz@users.noreply.github.com>
parent 2f84a1f2
...@@ -5196,9 +5196,8 @@ dependencies = [ ...@@ -5196,9 +5196,8 @@ dependencies = [
[[package]] [[package]]
name = "notify" name = "notify"
version = "8.1.0" version = "8.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/marcoshernanz/notify.git?rev=8e42e82e0710643d8f85eba2b2086bf8fb1b8427#8e42e82e0710643d8f85eba2b2086bf8fb1b8427"
checksum = "3163f59cd3fa0e9ef8c32f242966a7b9994fd7378366099593e0e73077cd8c97"
dependencies = [ dependencies = [
"bitflags 2.9.1", "bitflags 2.9.1",
"fsevent-sys", "fsevent-sys",
...@@ -5215,8 +5214,7 @@ dependencies = [ ...@@ -5215,8 +5214,7 @@ dependencies = [
[[package]] [[package]]
name = "notify-types" name = "notify-types"
version = "2.0.0" version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/marcoshernanz/notify.git?rev=8e42e82e0710643d8f85eba2b2086bf8fb1b8427#8e42e82e0710643d8f85eba2b2086bf8fb1b8427"
checksum = "5e0826a989adedc2a244799e823aece04662b66609d96af8dff7ac6df9a8925d"
[[package]] [[package]]
name = "nu-ansi-term" name = "nu-ansi-term"
......
...@@ -367,6 +367,8 @@ vergen-gitcl = { version = "1.0.8", features = ["cargo"] } ...@@ -367,6 +367,8 @@ vergen-gitcl = { version = "1.0.8", features = ["cargo"] }
webbrowser = "1.0.6" webbrowser = "1.0.6"
[patch.crates-io] [patch.crates-io]
# TODO: Remove after https://github.com/notify-rs/notify/pull/981 is released.
notify = { git = "https://github.com/marcoshernanz/notify.git", rev = "8e42e82e0710643d8f85eba2b2086bf8fb1b8427" }
bincode = { git = "https://github.com/bgw/bincode.git", branch = "bgw/patches" } bincode = { git = "https://github.com/bgw/bincode.git", branch = "bgw/patches" }
virtue = { git = "https://github.com/bgw/virtue.git", branch = "bgw/fix-generic-default-parsing" } virtue = { git = "https://github.com/bgw/virtue.git", branch = "bgw/fix-generic-default-parsing" }
# We have to very frequently bump the swc major version of mdxjs-rs # We have to very frequently bump the swc major version of mdxjs-rs
......
...@@ -1053,6 +1053,45 @@ mod tests { ...@@ -1053,6 +1053,45 @@ mod tests {
.unwrap(); .unwrap();
} }
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn polling_detects_subsecond_mtime_changes() {
let tt = TurboTasks::new(TurboTasksBackend::new(
BackendOptions::default(),
noop_backing_storage(),
));
tt.run_once(async move {
let fs = MockFileSystem::new(DiskWatcherConfig {
recursive_mode: Some(DiskWatcherRecursiveMode::NonRecursive),
poll_interval: Some(Duration::from_millis(100)),
report_invalidation_reason: true,
});
let file_path = fs.root_path.join("file.txt");
let initial_mtime = SystemTime::UNIX_EPOCH
+ Duration::from_secs(1_000_000)
+ Duration::from_millis(100);
fs::write(&file_path, "initial")?;
fs::File::options()
.write(true)
.open(&file_path)?
.set_modified(initial_mtime)?;
DiskWatcher::start_watching(fs.clone()).await?;
assert_eq!(fs.tracked_read_strongly_consistent(&file_path).await, 1);
// Keep this mtime-only so the test never exposes a transient current-time mtime.
fs::File::options()
.write(true)
.open(&file_path)?
.set_modified(initial_mtime + Duration::from_millis(100))?;
wait_for_rerun(&fs, &file_path, 1).await;
fs.watcher.stop_watching().await;
anyhow::Ok(())
})
.await
.unwrap();
}
/// `recursive_mode` is set explicitly rather than left to the platform default so that both /// `recursive_mode` is set explicitly rather than left to the platform default so that both
/// watching strategies are covered on every host. `TURBO_TASKS_FORCE_WATCH_MODE` still /// watching strategies are covered on every host. `TURBO_TASKS_FORCE_WATCH_MODE` still
/// overrides it, collapsing these into two cases. /// overrides it, collapsing these into two cases.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment