You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
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.
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?
The text was updated successfully, but these errors were encountered:
jamespfennell
changed the title
Restart collector if config file changes
Support restarting the collector if the config file changes
May 12, 2021
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 Hoardcollector
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: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?
The text was updated successfully, but these errors were encountered: