From fe2d6d3380fbba45e508d8fdce92c7ea1a0ca864 Mon Sep 17 00:00:00 2001 From: Lishen Yao Date: Tue, 5 Dec 2023 14:49:09 +0800 Subject: [PATCH] [fix][client] Exit when no msg to consume if time reaches the limit (#21622) Co-authored-by: Jiwe Guo --- .../org/apache/pulsar/testclient/PerformanceConsumer.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceConsumer.java b/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceConsumer.java index 9bd74be3aa859..bcdb981e1ebe5 100644 --- a/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceConsumer.java +++ b/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceConsumer.java @@ -505,6 +505,14 @@ public static void main(String[] args) throws Exception { reportHistogram.reset(); oldTime = now; + + if (arguments.testTime > 0) { + if (now > testEndTime) { + log.info("------------------- DONE -----------------------"); + PerfClientUtils.exit(0); + thread.interrupt(); + } + } } pulsarClient.close();