Skip to content

Commit

Permalink
reportNode优化
Browse files Browse the repository at this point in the history
  • Loading branch information
BeyondWUXF authored Nov 13, 2023
1 parent 1a6e46d commit 973d3bc
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions NodeServer/ServerManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,10 @@ void ServerManager::run()
time_t now = TNOWMS;

vector<TC_Endpoint> endPointList = Application::getCommunicator()->getEndpoint4All(_adminObj);
for(auto endPoint : endPointList)
set<string> adminHosts;
for(auto &endPoint : endPointList)
{
adminHosts.emplace(endPoint.getHost());
auto find = _adminPrxs.find(endPoint.getHost());
if(find == _adminPrxs.end())
{
Expand All @@ -255,16 +257,22 @@ void ServerManager::run()
auto itPrx = _adminPrxs.begin();
while (itPrx != _adminPrxs.end())
{
if(adminHosts.find(itPrx->first) == adminHosts.end())
{
itPrx = _adminPrxs.erase(itPrx);
continue;
}

try
{
itPrx->second->reportNode(rn);
++itPrx;
}
catch(exception &ex)
{
TLOG_ERROR("report admin, error:" << ex.what() << endl);
itPrx = _adminPrxs.erase(itPrx);
}

++itPrx;
}

int64_t diff = timeout-(TNOWMS-now);
Expand Down

0 comments on commit 973d3bc

Please sign in to comment.