From cb3729bc6a1189157b6d20221e11ad8240785f9e Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Wed, 27 Mar 2019 11:16:08 +0100 Subject: [PATCH] InfluxDB: Flush only if there's data in the buffer Regression from 2.10.4 --- lib/perfdata/influxdbwriter.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/perfdata/influxdbwriter.cpp b/lib/perfdata/influxdbwriter.cpp index 4a1f0b898..d732a83f2 100644 --- a/lib/perfdata/influxdbwriter.cpp +++ b/lib/perfdata/influxdbwriter.cpp @@ -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."; -- 2.40.0