zjncs opened a new pull request, #11062:
URL: https://github.com/apache/rocketmq/pull/11062
### Motivation
`ConsumeMessagePopConcurrentlyService.ConsumeRequest.run()` classifies a
slow consume as `TIME_OUT` only when:
```java
} else if (consumeRT >= invisibleTime * 1000) {
returnType = ConsumeReturnType.TIME_OUT;
```
but `invisibleTime` is parsed from `PROPERTY_POP_CK` via
`ExtraInfoUtil.getInvisibleTime()` and is already in **milliseconds** — the
sibling check in the same inner class, `isPopTimeout()`, compares `current -
popTime >= invisibleTime` in raw ms, and `DefaultMQPushConsumerImpl` clamps the
invisible window to 5000–300000 ms.
With the default 60s window the threshold becomes 60,000,000 ms (~16.7
hours), so `ConsumeReturnType.TIME_OUT` is effectively unreachable: consumes
slower than the invisible window are reported as `SUCCESS` through
`consumeMessageContext.getProps().put(MixAll.CONSUME_CONTEXT_TYPE, ...)`, so
consume hooks cannot see which pop consumes already exceeded their invisible
period. (The non-pop siblings multiply by 1000 because their base unit is
minutes.)
### Modifications
Compare `consumeRT >= invisibleTime` directly.
### Verification
Fail-before (new test
`testConsumeRequestReportsTimeOutWhenConsumeExceedsInvisibleTime`, run against
the unpatched code — a `ConsumeRequest` whose `PROPERTY_POP_CK` carries a 500
ms invisible time, with a listener sleeping 700 ms):
```
Tests run: 6, Failures: 1, Errors: 0 --
ConsumeMessagePopConcurrentlyServiceTest
org.junit.ComparisonFailure: expected:<[TIME_OUT]> but was:<[SUCCESS]>
```
Pass-after:
```
Tests run: 11, Failures: 0, Errors: 0, Skipped: 0 --
ConsumeMessagePopConcurrentlyServiceTest
```
--
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]