aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjackpoz <giacomopoz@gmail.com>2017-12-02 20:24:30 +0100
committerjackpoz <giacomopoz@gmail.com>2017-12-02 20:24:30 +0100
commite9c475d45f7fbe78d68e8d0cafe66b829acb6ce6 (patch)
tree2f779a0472d4c712d6e2e717959c6f45b15ba725
parent8e1c74d95a79a366ca755c9ebdc2fdd24c135284 (diff)
Shared/Metric: Stop metrics on shutdown
Properly stop metric information gathering and sending on shutdown. Issue reported by AddressSanitizer.
-rw-r--r--src/common/Metric/Metric.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/common/Metric/Metric.cpp b/src/common/Metric/Metric.cpp
index 10f0d13b688..e208cdc4aec 100644
--- a/src/common/Metric/Metric.cpp
+++ b/src/common/Metric/Metric.cpp
@@ -217,7 +217,12 @@ void Metric::ForceSend()
{
// 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();
+ }
}
void Metric::ScheduleOverallStatusLog()