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

Support restarting the collector if the config file changes #3

Open
jamespfennell opened this issue May 12, 2021 · 0 comments
Open

Comments

@jamespfennell
Copy link
Owner

Hoard currently assumes that the config file never changes, but there may be some cases where it does. For example, if the feeds to collect are auto-generated by some discovery method, they may be updated when the discovery method is re-run. In this case restarting the Hoard collector would be nice.

The implementation of this should be very easy. A new command line flag --watch-config would be added to the Hoard collector command to enable file watching. When the flag is not set, the current code runs like normal. If the flag is set, different logic runs. Two goroutines will be launched:

  1. The first goroutine will run the Hoard collector process, exactly like the current code. The only difference is that it will pass in a context that can be cancelled.
  2. The second goroutine will periodically check the config file. If it sees that the file has been updated it will cancel the context. The collector will then shut down (this may take a few seconds). When shutdown is complete, the second goroutine will start the collector again.

One edge case that should be thought: what if the updated config file is corrupt? Should Hoard crash? Or should it keep using the old config?

@jamespfennell jamespfennell changed the title Restart collector if config file changes Support restarting the collector if the config file changes May 12, 2021
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

1 participant