]> granicus.if.org Git - icinga2/commitdiff
Also apply buffer flush fix for Elasticsearch feature 7051/head
authorMichael Friedrich <michael.friedrich@icinga.com>
Wed, 27 Mar 2019 10:35:41 +0000 (11:35 +0100)
committerMichael Friedrich <michael.friedrich@icinga.com>
Wed, 27 Mar 2019 10:35:41 +0000 (11:35 +0100)
lib/perfdata/elasticsearchwriter.cpp

index 8b2aa8bdaad59d1238ffd98ae24dbb92884744f1..a8409f6354258af42cf4b90a0db8ca7a55b978ab 100644 (file)
@@ -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.
         */