Skip to content

Commit c9c46d7

Browse files
authored
Merge pull request mfontanini#171 from accelerated/async_flush
Added wait_for_acks(0) when calling async_flush
2 parents 5bfc047 + ace18d5 commit c9c46d7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

include/cppkafka/utils/buffered_producer.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,8 @@ class CPPKAFKA_API BufferedProducer {
221221
/**
222222
* \brief Flushes all buffered messages and returns immediately.
223223
*
224-
* Similar to flush, it will send all messages but will not wait for acks to complete.
224+
* Similar to flush, it will send all messages but will not wait for acks to complete. However the underlying
225+
* producer will still be flushed.
225226
*/
226227
void async_flush();
227228

@@ -641,6 +642,7 @@ void BufferedProducer<BufferType, Allocator>::async_flush() {
641642
};
642643
queue_flusher(retry_messages_, retry_mutex_);
643644
queue_flusher(messages_, mutex_);
645+
wait_for_acks(std::chrono::milliseconds(0)); //flush the producer but don't wait
644646
}
645647

646648
template <typename BufferType, typename Allocator>

0 commit comments

Comments
 (0)