This is an automated email from the ASF dual-hosted git repository.
eolivelli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/master by this push:
new 08e5d5b [testclient] Make option -time take effect in
PerformanceClient (#12020)
08e5d5b is described below
commit 08e5d5b6c16666e52822bfc454a0089ca3fe7984
Author: Ruguo Yu <[email protected]>
AuthorDate: Thu Oct 21 20:04:20 2021 +0800
[testclient] Make option -time take effect in PerformanceClient (#12020)
---
.../org/apache/pulsar/proxy/socket/client/PerformanceClient.java | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git
a/pulsar-testclient/src/main/java/org/apache/pulsar/proxy/socket/client/PerformanceClient.java
b/pulsar-testclient/src/main/java/org/apache/pulsar/proxy/socket/client/PerformanceClient.java
index 5d8b0eb..0ca5b93 100644
---
a/pulsar-testclient/src/main/java/org/apache/pulsar/proxy/socket/client/PerformanceClient.java
+++
b/pulsar-testclient/src/main/java/org/apache/pulsar/proxy/socket/client/PerformanceClient.java
@@ -212,8 +212,6 @@ public class PerformanceClient {
arguments.proxyURL += "/";
}
- arguments.testTime = TimeUnit.SECONDS.toMillis(arguments.testTime);
-
return arguments;
}
@@ -295,10 +293,17 @@ public class PerformanceClient {
executor.submit(() -> {
try {
RateLimiter rateLimiter =
RateLimiter.create(arguments.msgRate);
+ long startTime = System.nanoTime();
+ long testEndTime = startTime + (long) (arguments.testTime *
1e9);
// Send messages on all topics/producers
long totalSent = 0;
while (true) {
for (String topic : producersMap.keySet()) {
+ if (arguments.testTime > 0 && System.nanoTime() >
testEndTime) {
+ log.info("------------- DONE (reached the maximum
duration: [{} seconds] of production) --------------", arguments.testTime);
+ PerfClientUtils.exit(0);
+ }
+
if (arguments.numMessages > 0) {
if (totalSent >= arguments.numMessages) {
log.trace("------------- DONE (reached the
maximum number: [{}] of production) --------------", arguments.numMessages);