Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions include/snowplow/emitter/emitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ void Emitter::stop() {
locker.unlock();

this->m_check_db.notify_all();
this->m_check_retry.notify_all();
this->m_daemon_thread.join();
}
}
Expand Down Expand Up @@ -188,10 +189,11 @@ void Emitter::run() {
m_retry_delay.wont_retry_emit();
}

// sleep for the retry delay if there is one
// sleep for (up to) the retry delay if there is one
auto retry_delay = m_retry_delay.get();
if (retry_delay.count() > 0) {
sleep_for(retry_delay);
unique_lock<mutex> locker(m_retry_select);
m_check_retry.wait_for(locker, retry_delay);
}
} else {
m_check_fin.notify_all();
Expand Down
2 changes: 2 additions & 0 deletions include/snowplow/emitter/emitter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,11 @@ class Emitter {

thread m_daemon_thread;
condition_variable m_check_db;
condition_variable m_check_retry;
condition_variable m_check_fin;
mutex m_flush_fin;
mutex m_db_select;
mutex m_retry_select;
mutex m_run_check;
bool m_running;
EmitterCallback m_callback;
Expand Down