[fix][client] Release semaphore before discarding messages in batchMessageContainer
@@ -2030,9 +2030,9 @@ public class ProducerImpl<T> extends ProducerBase<T> implements TimerTask, Conne
}
final int numMessagesInBatch = batchMessageContainer.getNumMessagesInBatch();
final long currentBatchSize = batchMessageContainer.getCurrentBatchSize();
- batchMessageContainer.discard(ex);
semaphoreRelease(numMessagesInBatch);
client.getMemoryLimitController().releaseMemory(currentBatchSize);
+ batchMessageContainer.discard(ex);
}
@Override
