Catch flush timeout exception on buffered producer

This commit is contained in:
Matias Fontanini
2017-04-23 11:06:49 -07:00
parent e7db3df966
commit 35cf6fd0bf

View File

@@ -129,8 +129,19 @@ void BufferedProducer<BufferType>::flush() {
messages_acked_ = 0;
while (messages_acked_ != expected_acks_) {
try {
producer_.flush();
}
catch (const HandleException& ex) {
// If we just hit the timeout, keep going, otherwise re-throw
if (ex.get_error() == RD_KAFKA_RESP_ERR__TIMED_OUT) {
continue;
}
else {
throw;
}
}
}
}
template <typename BufferType>