Chia-Ping Tsai created KAFKA-20837:
--------------------------------------
Summary: Fix slow
MirrorConnectorsIntegrationBaseTest#produceMessages
Key: KAFKA-20837
URL: https://issues.apache.org/jira/browse/KAFKA-20837
Project: Kafka
Issue Type: Test
Reporter: Chia-Ping Tsai
Assignee: Chia-Ping Tsai
Many mirror tests need to produce a bunch of records, but the helper method
blocks until each record is completed. That is freaking slow for all tests...
We can refactor this while keeping the original timeout behaviour.
{code:java}
protected void produceMessages(Producer<byte[], byte[]> producer,
List<ProducerRecord<byte[], byte[]>> records) {
Timer timer = Time.SYSTEM.timer(RECORD_PRODUCE_DURATION_MS);
try {
var futures = records.stream().map(producer::send).toList();
for (var f : futures) {
f.get(timer.remainingMs(), TimeUnit.MILLISECONDS);
timer.update();
}
} catch (ExecutionException | InterruptedException | TimeoutException
e) {
throw new RuntimeException(e);
}
}
{code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)