chennaji9 opened a new pull request, #11289:
URL: https://github.com/apache/rocketmq/pull/11289

   <!-- Please make sure the target branch is right. In most case, the target 
branch should be `develop`. -->
   
   ### Which Issue(s) This PR Fixes
   
   Fixes #11280
   
   ### Brief Description
   
   Two benchmark-reporting defects in 
`example/src/main/java/org/apache/rocketmq/example/benchmark/BatchProducer.java`:
   
   1. The `InterruptedException` handler incremented `sendRequestFailedCount` 
and `sendMessageFailedCount` twice for the same failed batch (once before 
`Thread.sleep(3000)` and once after), so each interrupted batch of size N was 
reported as 2 failed requests / 2N failed messages. The duplicate increments 
are removed.
   2. `sendMessageSuccessTimeTotal` accumulated the elapsed time of every send 
result, including non-`SEND_OK`, while `printStats` divides that total by the 
success counters (`averageRT = (end[5] - begin[5]) / (end[1] - begin[1])`). 
Failed sends' latency therefore inflated the reported average success RT. The 
accumulation now happens only inside the `SEND_OK` branch (`currentRT` is 
computed once, before the status check, so the unchanged max-RT tracking keeps 
working).
   
   ### How Did You Test This Change?
   
   - `mvn -B -pl example -am -DskipTests -Dmaven.javadoc.skip=true compile` → 
BUILD SUCCESS (exit 0) with the change; `BatchProducer.class` freshly compiled.
   - `grep -c "getSendRequestFailedCount().increment()"` confirms the 
`InterruptedException` block now contributes exactly one increment (5 total 
across the file: result else-branch, RemotingException, InterruptedException, 
MQClientException, MQBrokerException).
   - Diff is minimal: 2 insertions / 4 deletions in a single file; no other 
thread loops, the stats printer or CLI parsing touched.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to