1
0
Fork 0

constituent starting anyway without inception

This commit is contained in:
Kaveh Vahedipour 2016-09-07 12:21:16 +02:00
parent 288f42c531
commit ae2cc90c1a
2 changed files with 11 additions and 10 deletions

View File

@ -133,10 +133,6 @@ bool Agent::activateStandbyAgent() { return true; }
/// Start constituent personality
void Agent::startConstituent() {
activateAgency();
auto database = ApplicationServer::getFeature<DatabaseFeature>("Database");
auto vocbase = database->vocbase();
auto queryRegistry = QueryRegistryFeature::QUERY_REGISTRY;
}
// Waits here for confirmation of log's commits up to index.

View File

@ -68,7 +68,8 @@ void AgencyCallback::refetchAndUpdate(bool needToAcquireMutex) {
return;
}
std::vector<std::string> kv = basics::StringUtils::split(AgencyComm::prefixPath() + key,'/');
std::vector<std::string> kv =
basics::StringUtils::split(AgencyComm::prefixPath() + key,'/');
kv.erase(std::remove(kv.begin(), kv.end(), ""), kv.end());
std::shared_ptr<VPackBuilder> newData = std::make_shared<VPackBuilder>();
@ -86,11 +87,14 @@ void AgencyCallback::checkValue(std::shared_ptr<VPackBuilder> newData) {
// Only called from refetchAndUpdate, we always have the mutex when
// we get here!
if (!_lastData || !_lastData->slice().equals(newData->slice())) {
LOG(DEBUG) << "AgencyCallback: Got new value " << newData->slice().typeName() << " " << newData->toJson();
LOG_TOPIC(DEBUG, Logger::CLUSTER)
<< "AgencyCallback: Got new value " << newData->slice().typeName()
<< " " << newData->toJson();
if (execute(newData)) {
_lastData = newData;
} else {
LOG(DEBUG) << "Callback was not successful for " << newData->toJson();
LOG_TOPIC(DEBUG, Logger::CLUSTER)
<< "Callback was not successful for " << newData->toJson();
}
}
}
@ -98,7 +102,7 @@ void AgencyCallback::checkValue(std::shared_ptr<VPackBuilder> newData) {
bool AgencyCallback::executeEmpty() {
// only called from refetchAndUpdate, we always have the mutex when
// we get here!
LOG(DEBUG) << "Executing (empty)";
LOG_TOPIC(DEBUG, Logger::CLUSTER) << "Executing (empty)";
bool result = _cb(VPackSlice::noneSlice());
if (result) {
_cv.signal();
@ -109,7 +113,7 @@ bool AgencyCallback::executeEmpty() {
bool AgencyCallback::execute(std::shared_ptr<VPackBuilder> newData) {
// only called from refetchAndUpdate, we always have the mutex when
// we get here!
LOG(DEBUG) << "Executing";
LOG_TOPIC(DEBUG, Logger::CLUSTER) << "Executing";
bool result = _cb(newData->slice());
if (result) {
_cv.signal();
@ -127,7 +131,8 @@ void AgencyCallback::executeByCallbackOrTimeout(double maxTimeout) {
if (!_cv.wait(static_cast<uint64_t>(maxTimeout * 1000000.0))) {
if (!_lastData || !_lastData->slice().equals(compareBuilder->slice())) {
LOG(DEBUG) << "Waiting done and nothing happended. Refetching to be sure";
LOG_TOPIC(DEBUG, Logger::CLUSTER)
<< "Waiting done and nothing happended. Refetching to be sure";
// mop: watches have not triggered during our sleep...recheck to be sure
refetchAndUpdate(false);
}