-
Notifications
You must be signed in to change notification settings - Fork 208
Add config hot-reloading #144
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
Add config hot-reloading #144
Conversation
|
When reloading the config, the reaper thread will disable optimisations then re-enable them while holding a write lock. However, |
This prevents a potential race condition for when the reaper thread reloads the config
|
Good point - I'd assumed that to be the case, but forgot that it was only the dbus single-threaded message queue that was protecting that race condition before. 4612533 should resolve that and passes the tests. |
| SD_BUS_VTABLE_UNPRIVILEGED), | ||
| SD_BUS_VTABLE_END | ||
| }; | ||
| static const sd_bus_vtable gamemode_vtable[] = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note this keeps getting changed by slightly differing clang-format versions. Perhaps we can do something about that eventually...
Add config hot-reloading
This PR sets up two new ways to refresh the current configuration. For safety, if GameMode is active it tears down the current optimizations on both system and clients, swaps out to a new config, and then rebuilds the optimizations.
The changes provide two ways to do this:
inotifyfor file changes, new config files, or moved and deleted config files. Currently uses the reaper thread to check the inotify file descriptor for updates.RefreshConfigdbus interface (not exposed ingamemode_client.hfor now).The dbus interface is implemented as a fallback, although perhaps an argument could be made that "supervisor" clients should be allowed to call this if ever needed, and a command line argument to
gamemodedcould be implemented alongside that.