]> granicus.if.org Git - icinga2/commitdiff
InfluxDB: Flush only if there's data in the buffer
authorMichael Friedrich <michael.friedrich@icinga.com>
Wed, 27 Mar 2019 10:16:08 +0000 (11:16 +0100)
committerMichael Friedrich <michael.friedrich@icinga.com>
Wed, 27 Mar 2019 10:26:00 +0000 (11:26 +0100)
Regression from 2.10.4

lib/perfdata/influxdbwriter.cpp

index 4a1f0b8980dc3993335433b24ebcda1804ab2058..d732a83f219047a74056e086e77e5919391631f4 100644 (file)
@@ -421,10 +421,6 @@ void InfluxdbWriter::FlushTimeoutWQ()
 {
        AssertOnWorkQueue();
 
-       // Flush if there are any data available
-       if (m_DataBuffer.empty())
-               return;
-
        Log(LogDebug, "InfluxdbWriter")
                << "Timer expired writing " << m_DataBuffer.size() << " data points";
 
@@ -433,6 +429,10 @@ void InfluxdbWriter::FlushTimeoutWQ()
 
 void InfluxdbWriter::Flush()
 {
+       /* Flush can be called from 1) Timeout 2) Threshold 3) on shutdown/reload. */
+       if (m_DataBuffer.empty())
+               return;
+
        Log(LogDebug, "InfluxdbWriter")
                << "Flushing data buffer to InfluxDB.";