mirror of
https://github.com/typesense/typesense.git
synced 2025-05-17 04:02:36 +08:00
Fix API server kicking in early before init readiness.
This commit is contained in:
parent
7cc8acfe45
commit
901795869d
@ -34,7 +34,7 @@ private:
|
||||
|
||||
std::string version;
|
||||
|
||||
std::vector<route_path> routes;
|
||||
std::vector<route_path> routes; // TODO: must be a hashmap?
|
||||
|
||||
const std::string listen_address;
|
||||
|
||||
|
@ -217,9 +217,9 @@ int HttpServer::find_route(const std::vector<std::string> & path_parts, const st
|
||||
|
||||
bool found = true;
|
||||
|
||||
for(size_t i = 0; i < rpath.path_parts.size(); i++) {
|
||||
const std::string & rpart = rpath.path_parts[i];
|
||||
const std::string & given_part = path_parts[i];
|
||||
for(size_t j = 0; j < rpath.path_parts.size(); j++) {
|
||||
const std::string & rpart = rpath.path_parts[j];
|
||||
const std::string & given_part = path_parts[j];
|
||||
if(rpart != given_part && rpart[0] != ':') {
|
||||
found = false;
|
||||
break;
|
||||
|
@ -317,7 +317,7 @@ int run_server(const Config & config, const std::string & version,
|
||||
// Wait for raft service to be ready before starting http
|
||||
// Follower or leader must have started AND data must also have been loaded
|
||||
LOG(INFO) << "Waiting for peering service to be ready before starting API service...";
|
||||
while(replication_state.get_init_readiness_count() >= 2) {
|
||||
while(replication_state.get_init_readiness_count() < 2) {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(500));
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user