diff --git a/arangod/Cluster/AgencyComm.cpp b/arangod/Cluster/AgencyComm.cpp index 4f8e517be1..e38674b52e 100644 --- a/arangod/Cluster/AgencyComm.cpp +++ b/arangod/Cluster/AgencyComm.cpp @@ -919,7 +919,7 @@ AgencyEndpoint* AgencyComm::createAgencyEndpoint (std::string const& endpointSpe /// @brief sends the current server state to the agency //////////////////////////////////////////////////////////////////////////////// -AgencyCommResult AgencyComm::sendServerState () { +AgencyCommResult AgencyComm::sendServerState (double ttl) { // construct JSON value { "status": "...", "time": "..." } TRI_json_t* json = TRI_CreateArrayJson(TRI_UNKNOWN_MEM_ZONE); @@ -933,7 +933,7 @@ AgencyCommResult AgencyComm::sendServerState () { TRI_Insert3ArrayJson(TRI_UNKNOWN_MEM_ZONE, json, "status", TRI_CreateString2CopyJson(TRI_UNKNOWN_MEM_ZONE, status.c_str(), status.size())); TRI_Insert3ArrayJson(TRI_UNKNOWN_MEM_ZONE, json, "time", TRI_CreateString2CopyJson(TRI_UNKNOWN_MEM_ZONE, stamp.c_str(), stamp.size())); - AgencyCommResult result(setValue("Sync/ServerStates/" + ServerState::instance()->getId(), json, 0.0)); + AgencyCommResult result(setValue("Sync/ServerStates/" + ServerState::instance()->getId(), json, ttl)); TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, json); return result; diff --git a/arangod/Cluster/AgencyComm.h b/arangod/Cluster/AgencyComm.h index 0208dc5d03..6b48f873b3 100644 --- a/arangod/Cluster/AgencyComm.h +++ b/arangod/Cluster/AgencyComm.h @@ -439,7 +439,7 @@ namespace triagens { /// @brief sends the current server state to the agency //////////////////////////////////////////////////////////////////////////////// - AgencyCommResult sendServerState (); + AgencyCommResult sendServerState (double ttl); //////////////////////////////////////////////////////////////////////////////// /// @brief gets the backend version diff --git a/arangod/Cluster/ApplicationCluster.cpp b/arangod/Cluster/ApplicationCluster.cpp index 661f35f97f..e3cfbd8a8d 100644 --- a/arangod/Cluster/ApplicationCluster.cpp +++ b/arangod/Cluster/ApplicationCluster.cpp @@ -262,7 +262,7 @@ bool ApplicationCluster::start () { // the agency about our state AgencyComm comm; - comm.sendServerState(); + comm.sendServerState(0.0); const std::string version = comm.getVersion(); @@ -430,7 +430,7 @@ void ApplicationCluster::close () { ServerState::instance()->setState(ServerState::STATE_SHUTDOWN); AgencyComm comm; - comm.sendServerState(); + comm.sendServerState(0.0); } //////////////////////////////////////////////////////////////////////////////// @@ -446,7 +446,7 @@ void ApplicationCluster::stop () { ServerState::instance()->setState(ServerState::STATE_SHUTDOWN); AgencyComm comm; - comm.sendServerState(); + comm.sendServerState(0.0); if (_heartbeat != 0) { _heartbeat->stop(); diff --git a/arangod/Cluster/HeartbeatThread.cpp b/arangod/Cluster/HeartbeatThread.cpp index 0b327682b7..c570fc53d0 100644 --- a/arangod/Cluster/HeartbeatThread.cpp +++ b/arangod/Cluster/HeartbeatThread.cpp @@ -461,7 +461,8 @@ bool HeartbeatThread::handleStateChange (AgencyCommResult& result, //////////////////////////////////////////////////////////////////////////////// bool HeartbeatThread::sendState () { - const AgencyCommResult result = _agency.sendServerState(); + const AgencyCommResult result = _agency.sendServerState( + 3.0 * static_cast(_interval) / 1000.0 / 1000.0); if (result.successful()) { _numFails = 0;