summaryrefslogtreecommitdiffstats
path: root/configd/src/apps/sentinel/sentinel.cpp
diff options
context:
space:
mode:
authorArne Juul <arnej@verizonmedia.com>2021-05-27 13:52:08 +0000
committerArne Juul <arnej@verizonmedia.com>2021-05-27 13:52:08 +0000
commit95e353b52f1c8e34727d7bb385fcc5baf89f481f (patch)
treeaef97bc38a15eddaef04b4612e10c0aaeeea6755 /configd/src/apps/sentinel/sentinel.cpp
parente6832404fb93af477d8f3829d7258827d6280a8a (diff)
use environment and bootstrap it before creating manager
Diffstat (limited to 'configd/src/apps/sentinel/sentinel.cpp')
-rw-r--r--configd/src/apps/sentinel/sentinel.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/configd/src/apps/sentinel/sentinel.cpp b/configd/src/apps/sentinel/sentinel.cpp
index 9d5a18d249f..53c9ae7fbc2 100644
--- a/configd/src/apps/sentinel/sentinel.cpp
+++ b/configd/src/apps/sentinel/sentinel.cpp
@@ -61,11 +61,10 @@ main(int argc, char **argv)
}
setlocale(LC_ALL, "C");
- sentinel::Manager handler;
-
+ sentinel::Env environment;
LOG(debug, "Reading configuration");
try {
- handler.subscribe(configId, CONFIG_TIMEOUT_MS);
+ environment.boot(configId);
} catch (ConfigTimeoutException & ex) {
LOG(warning, "Timeout getting config, please check your setup. Will exit and restart: %s", ex.getMessage().c_str());
EV_STOPPING("config-sentinel", ex.what());
@@ -80,11 +79,13 @@ main(int argc, char **argv)
return EXIT_FAILURE;
}
+ sentinel::Manager manager(environment);
+ manager.doConfigure();
vespalib::steady_time lastTime = vespalib::steady_clock::now();
while (!stop()) {
try {
vespalib::SignalHandler::CHLD.clear();
- handler.doWork(); // Check for child procs & commands
+ manager.doWork(); // Check for child procs & commands
} catch (InvalidConfigException& ex) {
LOG(warning, "Configuration problem: (ignoring): %s", ex.what());
} catch (vespalib::PortListenException& ex) {
@@ -102,7 +103,7 @@ main(int argc, char **argv)
int maxNum = 0;
fd_set fds;
FD_ZERO(&fds);
- handler.updateActiveFdset(&fds, &maxNum);
+ manager.updateActiveFdset(&fds, &maxNum);
struct timeval tv;
tv.tv_sec = 0;
@@ -118,6 +119,6 @@ main(int argc, char **argv)
}
EV_STOPPING("config-sentinel", "normal exit");
- int rv = handler.terminate();
+ int rv = manager.terminate();
return rv;
}