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

Improve watcher #113

Merged
merged 16 commits into from
Apr 27, 2024
Merged

Improve watcher #113

merged 16 commits into from
Apr 27, 2024

Conversation

Profpatsch
Copy link
Collaborator

  • Amended the changelog in release.nix (see release.nix for instructions)

@Profpatsch Profpatsch force-pushed the improve-watcher branch 3 times, most recently from ad46dad to b1bbb2a Compare April 5, 2024 20:58
The tests were kinda written in a weird way, instead of using the
`recv_timeout` function they would just hope events have arrived when
the `collect_all` function is called.

Note that we fix the idea behind the `macos_eat_late_notifications`
code by removing the `.is_empty()` again (which we don’t want!).
Instead we really just call `try_iter` to throw away all intermediate
messages.
We would `panic!` if the watch implementation encountered a problem
reading a file event etc., but really we shouldn’t care. Instead, just
throw a warning to make it debuggable, but continue on watching.

I inlined the unnecessary `log_event` helper.
We only return `false` for Modify events in our gcroots dir, otherwise
the `path_match` result.
It’s just a better environment that way … sigh
really trivial function, can get rid of the test as well.
All the times we add a path to `watches()`, it is first canonicalized.
So we document this invariant, and can remove the extra
canonicalization step from `path_match()`.

I also inline the function let binding.
This was not at all clear to me, but now it should be good for the
next person.
These two structs are only used for preventing automatic cleaning of
these resources, so their content is never used. Newer rust will warn
about that for structs as well.
We need to create a subdir, otherwise the tests will try to watch
`/tmp` …

This was hidden before because the tests were buggy in the way they
handled events.
I just cannot figure out how to fix this test. I think it was always
kinda broken, but it’s hard to see what is wrong, because it might be
the filtering we do or some race condition in how events are
generated.
@Profpatsch Profpatsch marked this pull request as ready for review April 19, 2024 08:58
@Profpatsch
Copy link
Collaborator Author

Ah great, I forgot to mark this as ready for review.
I’d merge it soon, because it includes a bunch of fixes to the watcher, including removing a panic!

@nyarly nyarly mentioned this pull request Apr 24, 2024
@nyarly
Copy link
Collaborator

nyarly commented Apr 24, 2024

I extended this in #125 such that it passes the Vim tests as well. I think those changes might also marginally reduce the number of builds Lorri does

@Profpatsch
Copy link
Collaborator Author

Okay, I’m gonna merge here and rebase the other one since that builds on this one. 👍

@Profpatsch Profpatsch merged commit ffbcf6d into canon Apr 27, 2024
6 checks passed
@Profpatsch Profpatsch deleted the improve-watcher branch April 27, 2024 07:58
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

Successfully merging this pull request may close these issues.

2 participants