mirror of
https://github.com/typesense/typesense.git
synced 2025-05-19 13:12:22 +08:00
Fix status endpoint response during snapshot loading.
This commit is contained in:
parent
b115caa23a
commit
df46ea28f9
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user