allthingssecurity commented on code in PR #27986:
URL: https://github.com/apache/camel/pull/27986#discussion_r4301872986


##########
components/camel-azure/camel-azure-servicebus/src/main/java/org/apache/camel/component/azure/servicebus/ServiceBusConsumer.java:
##########
@@ -342,9 +342,11 @@ public void run() {
                     continue;
                 }
 
-                // renew if lock is approaching expiry
+                // renew if the lock expires before the run after the next 
one: the period task scheduler runs this
+                // task every LOCK_RENEW_INTERVAL_SECONDS or a second later, 
so waiting for the next run when the lock
+                // expires within one interval can be too late, and the 
renewal itself is a call to Service Bus
                 Instant lockExpiry = entry.lockedUntil.toInstant();
-                if 
(now.plusSeconds(LOCK_RENEW_INTERVAL_SECONDS).isAfter(lockExpiry)) {
+                if (now.plusSeconds(2L * 
LOCK_RENEW_INTERVAL_SECONDS).isAfter(lockExpiry)) {

Review Comment:
   Thanks for checking. Agreed that short lock durations are a separate limit. 
With a 5 s lock and a renewer that runs every 10 to 11 s, the lock cannot be 
kept whatever the window is. I have noted it as a follow-up (run the renewer 
every 1 to 2 s, with the window scaled to the period) and kept this PR as it is.
   
   _Claude Code on behalf of allthingssecurity_
   



-- 
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