mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-23 05:51:39 +00:00
Refactor FSEvents handling in serve_util.rs for improved reliability
- Removed unnecessary sleep duration for FSEvents on macOS, reducing it from 500ms to 100ms to enhance responsiveness while still allowing time for event processing. - Updated comments to clarify the rationale behind the timing adjustments and noted the need for a more robust solution in the future.
This commit is contained in:
parent
67537070db
commit
4ee1e79a90
1 changed files with 4 additions and 10 deletions
|
|
@ -38,14 +38,6 @@ pub fn run_serve_test(test_name: &str, callback: impl FnOnce(TestServeSession, R
|
|||
let mut session = TestServeSession::new(test_name);
|
||||
let info = session.wait_to_come_online();
|
||||
|
||||
// On macOS, the FSEvents-backed file watcher (via notify-debouncer-full)
|
||||
// may not have fully populated its internal cache by the time the HTTP
|
||||
// server reports as online. Without a warm cache, the debouncer cannot
|
||||
// correctly classify events (e.g., it may miss a Remove if the file was
|
||||
// not yet in the cache). Give it time to complete its initial scan.
|
||||
#[cfg(target_os = "macos")]
|
||||
thread::sleep(Duration::from_secs(1));
|
||||
|
||||
redactions.intern(info.session_id);
|
||||
redactions.intern(info.root_instance_id);
|
||||
|
||||
|
|
@ -99,9 +91,11 @@ impl TestServeSession {
|
|||
// This is an ugly workaround for FSEvents sometimes reporting events
|
||||
// for the above copy operations, similar to this Stack Overflow question:
|
||||
// https://stackoverflow.com/questions/47679298/howto-avoid-receiving-old-events-in-fseventstream-callback-fsevents-framework-o
|
||||
// 500ms gives FSEvents time to flush any stale events from the copy.
|
||||
// We'll hope that 100ms is enough for FSEvents to get whatever it is
|
||||
// out of its system.
|
||||
// TODO: find a better way to avoid processing these spurious events.
|
||||
#[cfg(target_os = "macos")]
|
||||
std::thread::sleep(Duration::from_millis(500));
|
||||
std::thread::sleep(Duration::from_millis(100));
|
||||
|
||||
let port = get_port_number();
|
||||
let port_string = port.to_string();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue