Skip to content

Conversation

@karinushka
Copy link

Motivation and Context

This change adds a watcher for all service configuration files and if it detects a content change it will issue a reload event, restarting the service with potential new configuration parameters or flags.
This is quite useful for a long-running Horust process with a bunch of services and not needing to restart all
of them just to change a single service.

This is somewhat similar to the Reload configuration on signal received issue, although the reload happens on a configuration file change and not a signal.

Description

The change uses notify crate to register a watcher for all service toml files and if a content change happens it issues a Reload event into the main event loop.
From here the file contents are loaded and replaced into the ServiceHandler with areload_config flag set. Service is restarted using the normal Kill event and InKilling states. The difference is that when service enters the Success state at the end of the restart, it checks the reload_config flag and starts the service again.

How Has This Been Tested?

So far I've tested it with running a few sleep processes and trying to restart them with a different seconds parameter - verifying that they get restarted with new parameters.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation (a change to man pages or other documentation)

Checklist:

  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.

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