diff options
Diffstat (limited to 'configd/src/apps/sentinel/env.cpp')
-rw-r--r-- | configd/src/apps/sentinel/env.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/configd/src/apps/sentinel/env.cpp b/configd/src/apps/sentinel/env.cpp index 5bbbfd8f0bd..f857f95a496 100644 --- a/configd/src/apps/sentinel/env.cpp +++ b/configd/src/apps/sentinel/env.cpp @@ -36,6 +36,7 @@ constexpr int maxConnectivityRetries = 100; Env::Env() : _cfgOwner(), + _modelOwner("admin/model"), _rpcCommandQueue(), _rpcServer(), _stateApi(), @@ -52,6 +53,7 @@ Env::~Env() = default; void Env::boot(const std::string &configId) { LOG(debug, "Reading configuration for ID: %s", configId.c_str()); _cfgOwner.subscribe(configId, CONFIG_TIMEOUT_MS); + _modelOwner.start(CONFIG_TIMEOUT_MS, true); // subscribe() should throw if something is not OK Connectivity checker; for (int retry = 0; retry < maxConnectivityRetries; ++retry) { @@ -64,7 +66,11 @@ void Env::boot(const std::string &configId) { configId.c_str(), cfg.port.telnet, cfg.port.rpc); rpcPort(cfg.port.rpc); statePort(cfg.port.telnet); - checker.configure(cfg.connectivity); + _modelOwner.checkForUpdates(); + auto model = _modelOwner.getModelConfig(); + if (model.has_value()) { + checker.configure(cfg.connectivity, model.value()); + } } if (checker.checkConnectivity(*_rpcServer)) { _stateApi.myHealth.setOk(); @@ -94,7 +100,7 @@ void Env::rpcPort(int port) { if (_rpcServer && port == _rpcServer->getPort()) { return; // ok already } - _rpcServer = std::make_unique<RpcServer>(port, _rpcCommandQueue); + _rpcServer = std::make_unique<RpcServer>(port, _rpcCommandQueue, _modelOwner); } void Env::statePort(int port) { @@ -116,7 +122,6 @@ void Env::statePort(int port) { void Env::notifyConfigUpdated() { vespalib::ComponentConfigProducer::Config current("sentinel", _cfgOwner.getGeneration(), "ok"); _stateApi.myComponents.addConfig(current); - } void Env::respondAsEmpty() { |