summaryrefslogtreecommitdiffstats
path: root/filedistribution/src
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2017-05-02 13:01:25 +0200
committerHenning Baldersheim <balder@yahoo-inc.com>2017-05-04 10:40:33 +0200
commitb1088c7aae751c28f39ef551e1d4bf2f7599bcb3 (patch)
tree80dd5471679f25dcb8419384c88f80388f0f6893 /filedistribution/src
parentd74a4dd574b62f9c8619929d7f919807ff92321d (diff)
Ensure that we have gotten config at least once before starting up.
Diffstat (limited to 'filedistribution/src')
-rw-r--r--filedistribution/src/apps/filedistributor/filedistributor.cpp24
-rw-r--r--filedistribution/src/vespa/filedistribution/distributor/signalhandling.cpp2
2 files changed, 14 insertions, 12 deletions
diff --git a/filedistribution/src/apps/filedistributor/filedistributor.cpp b/filedistribution/src/apps/filedistributor/filedistributor.cpp
index 452b951bf6b..aac12610bd1 100644
--- a/filedistribution/src/apps/filedistributor/filedistributor.cpp
+++ b/filedistribution/src/apps/filedistributor/filedistributor.cpp
@@ -1,25 +1,20 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root
-#include <boost/program_options.hpp>
-
-#include <vespa/fastos/app.h>
-#include <vespa/config-zookeepers.h>
-
-#include <vespa/fileacquirer/config-filedistributorrpc.h>
#include <vespa/filedistribution/distributor/config-filedistributor.h>
#include <vespa/filedistribution/model/config-filereferences.h>
#include <vespa/filedistribution/distributor/filedistributortrackerimpl.h>
#include <vespa/filedistribution/distributor/filedownloadermanager.h>
-#include <vespa/filedistribution/distributor/filedownloader.h>
#include <vespa/filedistribution/distributor/signalhandling.h>
#include <vespa/filedistribution/distributor/state_server_impl.h>
#include <vespa/filedistribution/model/filedistributionmodelimpl.h>
#include <vespa/filedistribution/rpc/filedistributorrpc.h>
-#include <vespa/filedistribution/common/exception.h>
#include <vespa/filedistribution/common/componentsdeleter.h>
-#include <iostream>
+#include <vespa/fileacquirer/config-filedistributorrpc.h>
+#include <vespa/config-zookeepers.h>
+#include <vespa/fastos/app.h>
+#include <boost/program_options.hpp>
namespace {
const char* programName = "filedistributor";
@@ -182,7 +177,14 @@ public:
}
}
+ bool incompleteConfig() {
+ LockGuard guard(_configMutex);
+ return ! (_zooKeepersConfig && _fileDistributorConfig && _rpcConfig);
+ }
void createComponents(const config::ConfigUri & configUri) {
+ while (incompleteConfig()) {
+ std::this_thread::sleep_for(10ms);
+ }
LockGuard guard(_configMutex);
_components.reset(
new Components(configUri,
@@ -219,8 +221,8 @@ public:
(postPoneAskedToReinitializedSecs > 0 || !askedToReinitialize()) &&
!completeReconfigurationNeeded())
{
- postPoneAskedToReinitializedSecs--;
- std::this_thread::sleep_for(1s);
+ postPoneAskedToReinitializedSecs--;
+ std::this_thread::sleep_for(1s);
}
_components.reset();
}
diff --git a/filedistribution/src/vespa/filedistribution/distributor/signalhandling.cpp b/filedistribution/src/vespa/filedistribution/distributor/signalhandling.cpp
index 0465f8d7b29..9ac658ba619 100644
--- a/filedistribution/src/vespa/filedistribution/distributor/signalhandling.cpp
+++ b/filedistribution/src/vespa/filedistribution/distributor/signalhandling.cpp
@@ -1,5 +1,5 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/fastos/fastos.h>
+
#include "signalhandling.h"
#include <vespa/vespalib/util/signalhandler.h>