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

How to stop file watcher? #244

Open
halturin opened this issue Oct 27, 2023 · 3 comments
Open

How to stop file watcher? #244

halturin opened this issue Oct 27, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@halturin
Copy link

couldn't find a way to stop file-watching.

f := file.Provider("somefile.yaml"))

f.Watch(func(event any, e error) error {
  // handler
}

am I missing something?

@halturin halturin added the bug Something isn't working label Oct 27, 2023
@knadh
Copy link
Owner

knadh commented Oct 27, 2023

You're right, there's no way to currently stop watching files. Please feel free to send a PR. Perhaps an f.Unwatch().

@knadh knadh added enhancement New feature or request and removed bug Something isn't working labels Oct 27, 2023
@halturin
Copy link
Author

not sure if I have enough spare time in the near future. but if I implemented this feature, I would update the Provider interface by adding

Watch(func(...) error) error // returns error if doesn't support
Unwatch() error // same here

methods to make it more unified

@prateek-narsinghani
Copy link

prateek-narsinghani commented Oct 31, 2023

Hi @knadh ,
If this issue is still open would you mind taking a look at my PR #245.
I have tried implementing the unwatch function for file provider.
let me know if you feel any changes are to be made...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants