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

Disable recursion under Linux #556

Open
sebbASF opened this issue Apr 29, 2022 · 6 comments
Open

Disable recursion under Linux #556

sebbASF opened this issue Apr 29, 2022 · 6 comments

Comments

@sebbASF
Copy link

sebbASF commented Apr 29, 2022

Does not seem possible to disable recursion under Linux.
It should be possible to watch a single directory, without any subdirectories.

@ColinDKelley
Copy link
Collaborator

@sebbASF I don't think this is a feature of the underlying drivers like fs-event, is it?

It's not too hard to skip over the changes you don't want in the callbacks, is it?

@sebbASF
Copy link
Author

sebbASF commented Nov 29, 2022

It may not be hard, but why not allow this to be optionally done by the library?

@ColinDKelley
Copy link
Collaborator

but why not allow this to be optionally done by the library?

I was thinking to keep this gem uncomplicated. But if you want to propose an interface that allows that, please throw a proposal together.

Also, just to confirm, it sounds like you agree that this isn't a feature of the underlying drivers like fs-event?

@sebbASF
Copy link
Author

sebbASF commented Nov 30, 2022

AIUI under Linux, the gem uses inotify via rb-inotify.
Now inotify does not support recursion directly, so rb-inotify emulates this if the :recursive flag is provided.
By default it looks like listen includes the :recursive flag when configuring rb-inotify.

The problem is that it does not appear to be possible to disable this setting.

@sebbASF
Copy link
Author

sebbASF commented Dec 1, 2022

This is important because each additional directory monitored by inotify takes up system resources.
So although events can be filtered out later, for large directory trees there can be significant overhead.

@ColinDKelley
Copy link
Collaborator

Now inotify does not support recursion directly, so rb-inotify emulates this if the :recursive flag is provided.
By default it looks like listen includes the :recursive flag when configuring rb-inotify.

Ok, that sounds like a good reason to allow recursion to be disabled. If we support that, we'll need to disable it on the other drivers too. How difficult does that seem?

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

2 participants