From 415f509878d291e756eac1a5d3abc0a752aabe92 Mon Sep 17 00:00:00 2001 From: azw Date: Mon, 24 Apr 2023 11:26:39 +0000 Subject: [PATCH] 1 --- server/wsproxy/jsondatamgr.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/server/wsproxy/jsondatamgr.cc b/server/wsproxy/jsondatamgr.cc index 01fd26b..b84534c 100644 --- a/server/wsproxy/jsondatamgr.cc +++ b/server/wsproxy/jsondatamgr.cc @@ -47,11 +47,13 @@ void JsonDataMgr::UnInit() std::shared_ptr JsonDataMgr::GetConf() { - if (App::Instance()->GetInstanceId() < 1 || - App::Instance()->GetInstanceId() > wsproxyserver_cluster_json_.Size()) { - abort(); + for (int i = 0; i < wsproxyserver_cluster_json_.Size(); ++i) { + std::shared_ptr conf = wsproxyserver_cluster_json_.At(i); + if (conf->At("instance_id")->AsXValue().GetInt() == App::Instance()->GetInstanceId()) { + return conf; + } } - return wsproxyserver_cluster_json_[App::Instance()->GetInstanceId() - 1]; + A8_ABORT(); } void JsonDataMgr::TraverseMaster(std::function cb)