Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotwatch doesn't detect changes to file which are done while the handler callback is active #9

Open
hoerman opened this issue May 5, 2022 · 0 comments

Comments

@hoerman
Copy link

hoerman commented May 5, 2022

Hotwatch doesn't seem to detect changes done to files, which are done while a watch callback is running

let mut watch = Hotwatch::new().unwrap();

watch.watch("/tmp/test123", |e| {
    println!("{:?}", e);
    std::thread::sleep(Duration::from_secs(10));
}).unwrap();

Run this code an do an "echo >> /tmp/test123" once, and than a second time short after the debug printout appears. Hotwatch will only detect the first change to the file. The same happens with the blocking Variant of the module. Tested with Linux.

The behavior results in some possible race conditions, when one want's to be sure to always use the latest revision of the given file. At least this behavior should be noted in the module documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant