summaryrefslogtreecommitdiffstats
path: root/configd
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2017-05-25 23:04:59 +0200
committerHenning Baldersheim <balder@yahoo-inc.com>2017-05-25 23:04:59 +0200
commitf1d11bdac99dd77a2fcca92d7a68c6902d65834d (patch)
treeec70646ce0523ad3d10da036b5a9145715ddc3b7 /configd
parenta321b90e20adb82072ca3852000e55ef7514fcd0 (diff)
We can afford to wait a bit more for config, nor is it an error if it is late.
Diffstat (limited to 'configd')
-rw-r--r--configd/src/apps/sentinel/config-handler.cpp4
-rw-r--r--configd/src/apps/sentinel/config-handler.h2
-rw-r--r--configd/src/apps/sentinel/sentinel.cpp11
3 files changed, 11 insertions, 6 deletions
diff --git a/configd/src/apps/sentinel/config-handler.cpp b/configd/src/apps/sentinel/config-handler.cpp
index a801e405fde..1c9b53bde2b 100644
--- a/configd/src/apps/sentinel/config-handler.cpp
+++ b/configd/src/apps/sentinel/config-handler.cpp
@@ -152,9 +152,9 @@ ConfigHandler::terminate()
}
void
-ConfigHandler::subscribe(const std::string & configId)
+ConfigHandler::subscribe(const std::string & configId, uint64_t timeoutMS)
{
- _sentinelHandle = _subscriber.subscribe<SentinelConfig>(configId);
+ _sentinelHandle = _subscriber.subscribe<SentinelConfig>(configId, timeoutMS);
}
void
diff --git a/configd/src/apps/sentinel/config-handler.h b/configd/src/apps/sentinel/config-handler.h
index 2656a8df571..897f1e1ce3c 100644
--- a/configd/src/apps/sentinel/config-handler.h
+++ b/configd/src/apps/sentinel/config-handler.h
@@ -71,7 +71,7 @@ private:
public:
ConfigHandler();
virtual ~ConfigHandler();
- void subscribe(const std::string & configId);
+ void subscribe(const std::string & configId, uint64_t timeoutMS);
bool terminate();
int doWork();
void updateActiveFdset(fd_set *fds, int *maxNum);
diff --git a/configd/src/apps/sentinel/sentinel.cpp b/configd/src/apps/sentinel/sentinel.cpp
index 1f450185072..93849cdbf6c 100644
--- a/configd/src/apps/sentinel/sentinel.cpp
+++ b/configd/src/apps/sentinel/sentinel.cpp
@@ -1,4 +1,5 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
#include <sys/types.h>
#include <signal.h>
#include <cstring>
@@ -8,7 +9,6 @@
#include <vespa/defaults.h>
#include <vespa/log/log.h>
LOG_SETUP("config-sentinel");
-LOG_RCSID("$Id$");
#include <vespa/config-sentinel.h>
@@ -16,6 +16,8 @@ LOG_RCSID("$Id$");
using namespace config;
+constexpr uint64_t CONFIG_TIMEOUT_MS = 3 * 60 * 1000;
+
static int sigPermanent(int sig, void(*handler)(int));
static void gracefulShutdown(int sig);
@@ -65,7 +67,11 @@ main(int argc, char **argv)
LOG(debug, "Reading configuration");
try {
- handler.subscribe(configId);
+ handler.subscribe(configId, CONFIG_TIMEOUT_MS);
+ } catch (ConfigTimeoutException & ex) {
+ LOG(info, "Timout getting config, please check your setup. Will exit and restart: %s", ex.getMessage().c_str());
+ EV_STOPPING("config-sentinel", ex.what());
+ exit(EXIT_FAILURE);
} catch (InvalidConfigException& ex) {
LOG(error, "Fatal: Invalid configuration, please check your setup: %s", ex.getMessage().c_str());
EV_STOPPING("config-sentinel", ex.what());
@@ -142,4 +148,3 @@ sigPermanent(int sig, void(*handler)(int))
sa.sa_handler = handler;
return sigaction(sig, &sa, nullptr);
}
-