ElasticWriter: Ensure to flush buffers on Pause/Shutdown/Reload

This commit is contained in:
Michael Friedrich 2019-02-20 17:11:39 +01:00
parent 1bfe756cb1
commit 301c48e9bc
1 changed files with 5 additions and 2 deletions

View File

@ -104,13 +104,16 @@ void ElasticsearchWriter::Resume()
Checkable::OnNotificationSentToAllUsers.connect(std::bind(&ElasticsearchWriter::NotificationSentToAllUsersHandler, this, _1, _2, _3, _4, _5, _6, _7)); Checkable::OnNotificationSentToAllUsers.connect(std::bind(&ElasticsearchWriter::NotificationSentToAllUsersHandler, this, _1, _2, _3, _4, _5, _6, _7));
} }
/* Pause is equivalent to Stop, but with HA capabilities to resume at runtime. */
void ElasticsearchWriter::Pause() void ElasticsearchWriter::Pause()
{ {
Flush();
m_WorkQueue.Join();
Flush();
Log(LogInformation, "ElasticsearchWriter") Log(LogInformation, "ElasticsearchWriter")
<< "'" << GetName() << "' paused."; << "'" << GetName() << "' paused.";
m_WorkQueue.Join();
ObjectImpl<ElasticsearchWriter>::Pause(); ObjectImpl<ElasticsearchWriter>::Pause();
} }