From: Michael Friedrich Date: Wed, 27 Mar 2019 10:35:41 +0000 (+0100) Subject: Also apply buffer flush fix for Elasticsearch feature X-Git-Tag: v2.11.0-rc1~181^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=refs%2Fpull%2F7051%2Fhead;p=icinga2 Also apply buffer flush fix for Elasticsearch feature --- diff --git a/lib/perfdata/elasticsearchwriter.cpp b/lib/perfdata/elasticsearchwriter.cpp index 8b2aa8bda..a8409f635 100644 --- a/lib/perfdata/elasticsearchwriter.cpp +++ b/lib/perfdata/elasticsearchwriter.cpp @@ -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. */