Skip to content

Commit

Permalink
[pulsar-client] Avoid leak on publish failure on batch message (apach…
Browse files Browse the repository at this point in the history
  • Loading branch information
rdhabalia authored and merlimat committed Oct 23, 2019
1 parent 6258695 commit b466b08
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -468,10 +468,13 @@ private void doBatchSendAndAdd(MessageImpl<T> msg, SendCallback callback, ByteBu
log.debug("[{}] [{}] Closing out batch to accommodate large message with size {}", topic, producerName,
msg.getDataBuffer().readableBytes());
}
batchMessageAndSend();
batchMessageContainer.add(msg, callback);
lastSendFuture = callback.getFuture();
payload.release();
try {
batchMessageAndSend();
batchMessageContainer.add(msg, callback);
lastSendFuture = callback.getFuture();
} finally {
payload.release();
}
}

private boolean isValidProducerState(SendCallback callback) {
Expand Down

0 comments on commit b466b08

Please sign in to comment.