diff options
author | Arne Juul <arnej@verizonmedia.com> | 2021-06-11 12:57:24 +0000 |
---|---|---|
committer | Arne Juul <arnej@verizonmedia.com> | 2021-06-11 12:57:24 +0000 |
commit | 6f8792b0acfa3e417d124b519b6383065a6bfd7a (patch) | |
tree | 1aa4920a4dca29c97fc63dfb4cb86c1b61aed2f7 /configd/src/apps/sentinel/env.cpp | |
parent | e607968dff6eee82f22f8aacc35e31d4afa2d807 (diff) |
add separate config subscriber for model
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..58b917ca16e 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(), + _modelSubscriber("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); + _modelSubscriber.start(CONFIG_TIMEOUT_MS); // subscribe() should throw if something is not OK Connectivity checker; for (int retry = 0; retry < maxConnectivityRetries; ++retry) { @@ -64,7 +66,10 @@ 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); + auto model = _modelSubscriber.getModelConfig(); + if (model.has_value()) { + checker.configure(cfg.connectivity, model.value()); + } } if (checker.checkConnectivity(*_rpcServer)) { _stateApi.myHealth.setOk(); @@ -94,7 +99,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, _modelSubscriber); } void Env::statePort(int port) { @@ -116,7 +121,7 @@ void Env::statePort(int port) { void Env::notifyConfigUpdated() { vespalib::ComponentConfigProducer::Config current("sentinel", _cfgOwner.getGeneration(), "ok"); _stateApi.myComponents.addConfig(current); - + _modelSubscriber.checkForUpdates(); } void Env::respondAsEmpty() { |