mirror of https://github.com/Icinga/icinga2.git
Merge pull request #7051 from Icinga/bugfix/influxdb-flush-buffer
InfluxDB/Elasticsearch: Flush only if there's data in the buffer
This commit is contained in:
commit
bea24c20f7
|
@ -398,6 +398,10 @@ void ElasticsearchWriter::FlushTimeout()
|
|||
|
||||
void ElasticsearchWriter::Flush()
|
||||
{
|
||||
/* Flush can be called from 1) Timeout 2) Threshold 3) on shutdown/reload. */
|
||||
if (m_DataBuffer.empty())
|
||||
return;
|
||||
|
||||
/* Ensure you hold a lock against m_DataBuffer so that things
|
||||
* don't go missing after creating the body and clearing the buffer.
|
||||
*/
|
||||
|
|
|
@ -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.";
|
||||
|
||||
|
|
Loading…
Reference in New Issue