allthingssecurity opened a new pull request, #28460:
URL: https://github.com/apache/camel/pull/28460

   # Description
   
   [CAMEL-25809](https://issues.apache.org/jira/browse/CAMEL-25809)
   
   Follow-up of #28201, for the two points of @oscerd's review of it. #28201 
was merged before these were pushed to its branch.
   
   - **Later extensions are counted from the call.** SQS counts a new 
visibility timeout from the time of the `ChangeMessageVisibility` call. The 
`TimeoutExtender` counted the next deadline from `Instant.now()` after 
`changeMessageVisibilityBatch` returned, so the response time, and any pause of 
the extender thread, came out of the 20% margin (0.4 s at 
`visibilityTimeout=2`). It now takes the time before it sends the request and 
counts the next deadline from it 
(`TimeoutExtenderEntry.extendDeadline(Instant)`).
   - **No immediate extension for a batch that is not routed.** `processBatch` 
queued the immediate extender run before the loop checked `isBatchAllowed()`. 
When the consumer is stopping or suspending, the batch is not routed and 
`stopExtending` removes its messages, but the queued run could still extend 
them once more, so they became visible later than their own timeout. The 
immediate run is now queued only `if (due && isBatchAllowed())`. The window 
that remains when the consumer starts stopping after that check is the one the 
scheduled runs already have.
   
   Tests:
   - New `SqsConsumerExtendMessageVisibilitySlowCallTest`: at 
`visibilityTimeout=4` the response to the first extension takes 3 s, and the 
second extension must start less than 4 s after the first call. Without the 
first change it starts 6 s after it (`Expecting actual: 6000L to be less than: 
4000L`; the extender skips the runs at +3 s and +4 s).
   - No test for the second change: the race is between the extender thread 
reading the entries and the poll thread removing them, and it cannot be made 
deterministic without hooks in the consumer.
   - camel-aws2-sqs unit tests on current main with this change: 79 run, 0 
failures, plus the SQS deterministic simulation test (200 seeds), 0 failures. 
Run with the AWS SDK 2.55.15 jars of my local repository 
(`-Daws-java-sdk2-version=2.55.15`); main uses 2.56.0.
   
   What was not run: the integration tests (they need LocalStack); the full 
root build.
   
   # Target
   
   - [x] I checked that the commit is targeting the correct branch (Camel 4 
uses the `main` branch)
   
   # Tracking
   - [x] If this is a large change, bug fix, or code improvement, I checked 
there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for 
the change (usually before you start working on it): 
[CAMEL-25809](https://issues.apache.org/jira/browse/CAMEL-25809) (follow-up of 
#28201).
   
   # Apache Camel coding standards and style
   
   - [x] I checked that each commit in the pull request has a meaningful 
subject line and body.
   - [ ] I have run `mvn clean install -DskipTests` locally from root folder 
and I have committed all auto-generated changes.
     (I built and tested camel-aws2-sqs, including the formatter and 
import-sort plugins; no generated file changes. I did not run the full root 
build.)
   
   # AI-assisted contributions
   
   - [x] If this PR includes AI-generated code, commits have proper 
co-authorship attribution (e.g., `Co-authored-by` trailers) and the PR 
description identifies the AI tool used.
     This PR was prepared with Claude Code (Claude Opus 5.5). The commit 
carries a `Co-Authored-By` trailer.
   
   _Claude Code on behalf of allthingssecurity_
   
   🤖 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