-
Notifications
You must be signed in to change notification settings - Fork 229
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
Rescan flag is correctness hazard #434
Comments
(I took the liberty of formatting your comment to better distinguish the quotes, as I've had a hard time parsing it at first) |
If possible we could move that Event towards its own EventKind, not sure about that. And think about how we handle this for the debouncer (re-initialize?) |
This could be a blocker for v5 if we change the types, I think I'd rather skip this and wait for v6 ? CC #249 |
Moving it to its own kind would help. That way people who filter on kind would have to decide what to do about it. But I think you also want to do something about Sorry to report this so late in the 5.x process. I only came across it while reviewing an "update to notify 5.x" MR in a project that uses |
What does DTWT mean ? (Same for FTAOD) |
Embarrassing fact: I've never had to interact with that Flag before. So I didn't actually remember it existed.. Yeah that API is bad. |
I think you should never expect there to be a nonzero list of elements. So I don't see how that would be a problem. Regarding use cases: |
As an alternative, having some |
DTWT = Do The Wrong Thing (cf DTRT = Do The Right Thing). FTAOD = For The Avoidance Of Doubt. |
I'm not sure I follow. I haven't tested (or UTSL) but I believe the rescan event has an empty [1] It Seems To Me |
Should I submit a PR with my "low effort solution", while a longer-term (6.x) solution is being discussed? |
Yeah I'd appreciate that. |
Almost every caller of
notify
needs to handle rescan events, to be correct.However, in order to discover that this thing even exists it is necessary to dig many levels deep in the documentation. In particular, starting from
Event
, one must navigate the following:attrs: EventAttributes
This does not look like somethilng one needs to consider in a simple program. Most readers will only look here if they are trying to find how to do something complicated and can't find the API for it elsewhere.
pub fn flag(&self) -> Option<Flag>
Again, this text does not even hint that looking at this flag is necessary for a reliable program.
notify::event::Flag
Once again, the reader is discouraged from reading on. Eventually we come to this:
Rescan
Here, at least, the careful reader will notice that actually this flag means "we have missed stuff". But you have to read this text quite carefully. The critical information is in the last sentence. (I don't really agree that "An application that simply reacts to file changes may not care about this". Any application that doesn't also separately poll will malfunction if rescan lapses occur but or not handled.)
I think this API is setting up developers for failure. Specifically, it is setting up developers for writing programs which mysteriously lose file updates but only when the system is under load.
IMO
Event
should have a structure which makes it impossible to accesspaths
orkind
without checking forRescan
. After all, aRescan
event conceptually applies to all paths and all kinds, so an application which filters on paths or kind must know aboutRescan
.(edit: FTAOD I am talking about the 5.x preview API here.)
The text was updated successfully, but these errors were encountered: