-
-
Notifications
You must be signed in to change notification settings - Fork 888
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
Removing recursive watches #41
Comments
Right now I can only think of two possible ways to remove recursive watches for #18:
I'm in favour of 2, as additional watches could be created, and the API at present takes a path rather than a handle to a previous watch. However, I'd still like to see how Windows and FSEvents (OS X) handle recursive watches and removals before tackling this... which puts it a fair ways off. |
I'm not quite clear about what we're discussing here. I'm trying to implement recursive watching myself, today, independently of #18. fsnotify does not let me do this without keeping track of all watches (i.e. duplicating
You can't do this once the directory is gone. So I'm interested in a way of getting at |
Quite some time ago I attempted to track all the watched folders independently, but ran into an issue much like #40 in kqueue. I thought the watches were just magically removed when the folder was deleted, but I may have been wrong. (nathany/looper@212051b) It might be worth building a small test case to see if unwatching deleted folders is necessary. I started hacking on fslog as a place to do those sort of experiments (without all the other stuff fsnotify adds). But so far it only has kqueue. It should be relatively easy to resolve #40, but I'd rather not expose w.watches as an API. It's supposed to be an internal detail. |
It is not necessary from an inotify perspective; the watch is gone when the inode goes away. A satisfactory solution to this might very well be "you don't have to delete watches for removed directories; they are removed automatically." But then we'd have to make sure that works:
|
So for 2, fsnotify should itself watch for remove event and do the internal cleanup of w.watches. That could be tricky later on if the user doesn't wish to subscribe to remove events (#7). But for now, my focus is on cleaning up the existing code, primarily separating the lower-level stuff out. Also doing more research as with 1. Fixing #40 and doing the internal cleanup could fit into that. |
There is now the Better support for e.g. |
I've implemented recursive watching for a few different projects. The way I've basically done this is:
create
event, walk the created dir and add new watches for alldirs
remove
event, remove the watch for that dir(I'm using fsnotify.v1.) I've realized that this isn't correct, because I don't delete the watches recursively. So I guess I need to keep track of the full tree of watches on my end as well? Maybe fsnotify could help out by exposing a 'delete all watches with this prefix' method or something.
Suggestions?
Additionally, #40 means that even if I could know all the dirs to remove watches for, I still couldn't delete them.
The text was updated successfully, but these errors were encountered: