Fix status endpoint response during snapshot loading.

This commit is contained in:
Kishore Nallan 2022-07-02 18:08:24 +05:30
parent b115caa23a
commit df46ea28f9

View File

@ -128,6 +128,7 @@ int ReplicationState::start(const butil::EndPoint & peering_endpoint, const int
LOG(INFO) << "Node last_index: " << node_status.last_index;
std::unique_lock lock(node_mutex);
this->node = node;
return 0;
}
@ -826,6 +827,10 @@ nlohmann::json ReplicationState::get_status() {
std::shared_lock lock(node_mutex);
if(!node) {
// `node` is not yet initialized (probably loading snapshot)
status["state"] = "NOT_READY";
status["committed_index"] = 0;
status["queued_writes"] = 0;
return status;
}