mirror of
https://bitbucket.org/theswgsource/src-1.2.git
synced 2026-08-03 04:19:20 -04:00
add ConfigCentralServer::getMetricsDataURL() and move the stats collection functionality to the function that sends to the login server; this may or may not be optimal depending on how often it is updated
This commit is contained in:
@@ -2771,12 +2771,6 @@ void CentralServer::update()
|
||||
static int loopCount=0;
|
||||
m_curTime = static_cast<uint32>(time(0));
|
||||
|
||||
// stella: Adding those for sending regular updates through WebAPI to the webserver
|
||||
std::string updateURL = "http://webdev/test/asdf/asdf"; //todo: add config vars to CentralServer config header and cpp
|
||||
|
||||
std::ostringstream postBuf;
|
||||
postBuf << "population=" << CentralServer::getInstance().getPlayerCount();
|
||||
|
||||
// Tell the LoginServers if necessary
|
||||
if ((++loopCount > ConfigCentralServer::getUpdatePlayerCountFrequency()))
|
||||
{
|
||||
@@ -2784,7 +2778,6 @@ void CentralServer::update()
|
||||
|
||||
// Update the population on the server
|
||||
sendPopulationUpdateToLoginServer();
|
||||
webAPI::simplePost(updateURL, std::string(postBuf.str()), "");
|
||||
}
|
||||
|
||||
if ( ConfigCentralServer::getAuctionEnabled() ) // allow auctions?
|
||||
@@ -2847,6 +2840,17 @@ void CentralServer::sendPopulationUpdateToLoginServer()
|
||||
if (!isPreloadFinished() || (time(0)-m_lastLoadingStateTime < static_cast<time_t>(ConfigCentralServer::getRecentLoadingStateSeconds())))
|
||||
loadedRecently=true;
|
||||
|
||||
// stella: Adding those for sending regular updates through WebAPI to the webserver
|
||||
std::string updateURL = std::string(ConfigCentralServer::getMetricsDataURL());
|
||||
|
||||
if (!(updateURL.empty()))
|
||||
{
|
||||
std::ostringstream postBuf;
|
||||
postBuf << "totalPlayerCount=" << m_totalPlayerCount << "&totalEmptySceneCount=" << m_totalEmptySceneCount << "&totalFreeTrialCount=" << m_totalFreeTrialCount << "&totalTutorialSceneCount=" << m_totalTutorialSceneCount << "&totalFalconSceneCount=" << m_totalFalconSceneCount;
|
||||
|
||||
webAPI::simplePost(updateURL, std::string(postBuf.str()), "");
|
||||
}
|
||||
|
||||
UpdatePlayerCountMessage upm(loadedRecently, m_totalPlayerCount, m_totalFreeTrialCount, m_totalEmptySceneCount, m_totalTutorialSceneCount, m_totalFalconSceneCount);
|
||||
sendToAllLoginServers(upm);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user