Shared/Metric: Fix crash on shutdown

Fix crash on shutdown with metrics enabled but InfluxDB stopping before worldserver

(cherry picked from commit 45b2bcfaf2)
This commit is contained in:
jackpoz
2017-12-17 14:35:18 +01:00
committed by funjoker
parent 7bd3914663
commit 8313053a3b
3 changed files with 6 additions and 5 deletions

View File

@@ -213,16 +213,17 @@ void Metric::ScheduleSend()
}
}
void Metric::ForceSend()
void Metric::Unload()
{
// Send what's queued only if IoContext is stopped (so only on shutdown)
if (_enabled && Trinity::Asio::get_io_context(*_batchTimer).stopped())
{
_enabled = false;
SendBatch();
_batchTimer->cancel();
_overallStatusTimer->cancel();
}
_batchTimer->cancel();
_overallStatusTimer->cancel();
}
void Metric::ScheduleOverallStatusLog()