mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-12 15:53:44 +00:00
feat(master): report the UGC server in the server list and wait for it on shutdown
The server list now carries whether master starts the UGC server, whether it is connected and the pid it was started as. Settings reloads reach it like auth and chat, and shutdown waits for it. The UGC server sends its totals and storage with its traffic reports. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -323,6 +323,15 @@ int main(int argc, char** argv) {
|
||||
TrafficStats::Local().SetGauge("workers_busy", [&processor] { return static_cast<double>(processor.Busy()); });
|
||||
TrafficStats::Local().SetGauge("workers_queued", [&processor] { return static_cast<double>(processor.Queued()); });
|
||||
TrafficStats::Local().SetGauge("workers_threads", [&processor] { return static_cast<double>(processor.Threads()); });
|
||||
// Read on this thread, when a traffic report is taken (dServer::ReceiveFromMaster)
|
||||
const std::vector<std::pair<std::string, std::function<double()>>> ugcGauges{
|
||||
{ "ugc_made_total", [&processor] { return static_cast<double>(processor.Made()); } },
|
||||
{ "ugc_failed_total", [&processor] { return static_cast<double>(processor.Failed()); } },
|
||||
{ "ugc_evicted_total", [&processor] { return static_cast<double>(processor.Evicted()); } },
|
||||
{ "ugc_stored_bytes", [&processor] { return static_cast<double>(processor.StoredBytes()); } },
|
||||
{ "ugc_max_storage_bytes", [&processor] { return static_cast<double>(processor.MaxStorageBytes()); } },
|
||||
};
|
||||
for (const auto& [name, gauge] : ugcGauges) TrafficStats::Local().SetGauge(name, gauge);
|
||||
|
||||
const auto listenIp = Game::config->GetValue("listen_ip").empty() ? std::string("0.0.0.0") : Game::config->GetValue("listen_ip");
|
||||
const auto port = Setting<uint32_t>("port", 2008);
|
||||
@@ -355,6 +364,7 @@ int main(int argc, char** argv) {
|
||||
TrafficStats::Local().SetGauge("workers_busy", nullptr);
|
||||
TrafficStats::Local().SetGauge("workers_queued", nullptr);
|
||||
TrafficStats::Local().SetGauge("workers_threads", nullptr);
|
||||
for (const auto& [name, gauge] : ugcGauges) TrafficStats::Local().SetGauge(name, nullptr);
|
||||
Game::web.Shutdown();
|
||||
g_Processor = nullptr;
|
||||
Database::Destroy("UgcServer");
|
||||
|
||||
Reference in New Issue
Block a user