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

Fallback on PollWatcher #18

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

evanr70
Copy link
Contributor

@evanr70 evanr70 commented Sep 29, 2023

Users may not have control over the max watches limit of the recommended_watcher. In this case, it is desirable to fallback to the PollWatcher implementation which is x-platform as far as I can tell and shouldn't experience the same restriction.

To check if the watcher limit has been reached, we create a NamedTempFile using tempfile and check the result of watcher.watch on the recommended_watcher.

I've also removed some unwraps which were causing problems. Some are replaced with match blocks, others with bindings. I can't see any immediate problems from this, but it might be worth checking it out.

The checking code might be better off in a separate function which returns a Box<dyn Watcher> so can do that if you'd prefer.

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.

1 participant