[bug] pulsar-perf consume, do not fail in case of reading data older than 10 days
@@ -81,8 +81,9 @@ public class PerformanceConsumer {
private static final LongAdder totalEndTxnOpSuccessNum = new LongAdder();
private static final LongAdder numTxnOpSuccess = new LongAdder();
- private static final Recorder recorder = new Recorder(TimeUnit.DAYS.toMillis(10), 5);
- private static final Recorder cumulativeRecorder = new Recorder(TimeUnit.DAYS.toMillis(10), 5);
+ private static final long MAX_LATENCY = TimeUnit.DAYS.toMillis(10);
+ private static final Recorder recorder = new Recorder(MAX_LATENCY, 5);
+ private static final Recorder cumulativeRecorder = new Recorder(MAX_LATENCY, 5);
@Parameters(commandDescription = "Test pulsar consumer performance.")
static class Arguments extends PerformanceBaseArguments {
@@ -320,6 +321,9 @@ public class PerformanceConsumer {
long latencyMillis = System.currentTimeMillis() - msg.getPublishTime();
if (latencyMillis >= 0) {
+ if (latencyMillis >= MAX_LATENCY) {
+ latencyMillis = MAX_LATENCY;
+ }
recorder.recordValue(latencyMillis);
cumulativeRecorder.recordValue(latencyMillis);
}
