diff --git a/src/common/Metric/Metric.cpp b/src/common/Metric/Metric.cpp index bd85342be87..b04fa645b67 100644 --- a/src/common/Metric/Metric.cpp +++ b/src/common/Metric/Metric.cpp @@ -208,16 +208,17 @@ void Metric::ScheduleSend() } } -void Metric::ForceSend() +void Metric::Unload() { // Send what's queued only if io_service is stopped (so only on shutdown) if (_enabled && _batchTimer->get_io_service().stopped()) { _enabled = false; SendBatch(); - _batchTimer->cancel(); - _overallStatusTimer->cancel(); } + + _batchTimer->cancel(); + _overallStatusTimer->cancel(); } void Metric::ScheduleOverallStatusLog() diff --git a/src/common/Metric/Metric.h b/src/common/Metric/Metric.h index 8e4d1292519..82befe803ea 100644 --- a/src/common/Metric/Metric.h +++ b/src/common/Metric/Metric.h @@ -110,7 +110,7 @@ public: void LogEvent(std::string const& category, std::string const& title, std::string const& description); - void ForceSend(); + void Unload(); bool IsEnabled() const { return _enabled; } }; diff --git a/src/server/worldserver/Main.cpp b/src/server/worldserver/Main.cpp index 61b6c01b282..45473f9ad85 100644 --- a/src/server/worldserver/Main.cpp +++ b/src/server/worldserver/Main.cpp @@ -232,7 +232,7 @@ extern int main(int argc, char** argv) std::shared_ptr sMetricHandle(nullptr, [](void*) { TC_METRIC_EVENT("events", "Worldserver shutdown", ""); - sMetric->ForceSend(); + sMetric->Unload(); }); sScriptMgr->SetScriptLoader(AddScripts);