1
0
mirror of https://github.com/ohwgiles/laminar.git synced 2026-11-02 08:34:44 +00:00

resolves #34: watch for configuration changes

Reload the configuration if a change is detected
without requiring a server restart
This commit is contained in:
Oliver Giles
2018-04-06 18:04:50 +03:00
parent a5d8b985f1
commit 216ecee7c5
7 changed files with 50 additions and 14 deletions

View File

@@ -364,6 +364,8 @@ void Laminar::run() {
const char* listen_http = getenv("LAMINAR_BIND_HTTP") ?: INTADDR_HTTP_DEFAULT;
srv = new Server(*this, listen_rpc, listen_http);
srv->addWatchPath(fs::path(fs::path(homeDir)/"cfg"/"nodes").string().c_str());
srv->addWatchPath(fs::path(fs::path(homeDir)/"cfg"/"jobs").string().c_str());
srv->start();
}
@@ -530,6 +532,13 @@ void Laminar::reapChildren() {
assignNewJobs();
}
void Laminar::notifyConfigChanged()
{
loadConfiguration();
// config change may allow stuck jobs to dequeue
assignNewJobs();
}
void Laminar::abortAll() {
for(std::shared_ptr<Run> run : activeJobs) {
run->abort();