diff --git a/core-writer/include/ZmqRecvModule.hpp b/core-writer/include/ZmqRecvModule.hpp index e8e845c..7f861b7 100644 --- a/core-writer/include/ZmqRecvModule.hpp +++ b/core-writer/include/ZmqRecvModule.hpp @@ -29,7 +29,7 @@ public: void stop_recv(); void start_saving(); - void stop_saving(); + void stop_saving_and_clear_buffer(); }; #endif \ No newline at end of file diff --git a/core-writer/src/module/ZmqRecvModule.cpp b/core-writer/src/module/ZmqRecvModule.cpp index 9738cfa..1bcb143 100644 --- a/core-writer/src/module/ZmqRecvModule.cpp +++ b/core-writer/src/module/ZmqRecvModule.cpp @@ -97,7 +97,7 @@ void ZmqRecvModule::start_saving() is_saving_ = true; } -void ZmqRecvModule::stop_saving() +void ZmqRecvModule::stop_saving_and_clear_buffer() { #ifdef DEBUG_OUTPUT using namespace date; @@ -108,6 +108,12 @@ void ZmqRecvModule::stop_saving() #endif is_saving_ = false; + + // TODO: Solve the problem differently - control to RB? + this_thread::sleep_for(chrono::milliseconds( + config::recv_saving_wait_ms)); + + ring_buffer_.clear(); } void ZmqRecvModule::receive_thread(const string& connect_address)