Skip to content

Commit

Permalink
ElasticsearchWriter#Pause(): lock m_DataBufferMutex during Flush()
Browse files Browse the repository at this point in the history
just to be sure regarding race conditions.
  • Loading branch information
Al2Klimov authored Jun 30, 2023
1 parent d5e6ece commit 076eb59
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/perfdata/elasticsearchwriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,11 @@ void ElasticsearchWriter::Pause()

m_FlushTimer->Stop(true);
m_WorkQueue.Join();
Flush();

{
std::unique_lock<std::mutex> lock (m_DataBufferMutex);
Flush();
}

Log(LogInformation, "ElasticsearchWriter")
<< "'" << GetName() << "' paused.";
Expand Down

0 comments on commit 076eb59

Please sign in to comment.