gnodet-bot commented on code in PR #28199:
URL: https://github.com/apache/camel/pull/28199#discussion_r4331705576


##########
components/camel-github2/src/main/java/org/apache/camel/component/github2/consumer/CommitConsumer.java:
##########
@@ -140,6 +153,12 @@ protected int poll() throws Exception {
                     newCommits.push(commit);
                 }
             }
+            if (newCommits.isEmpty() && lastSha != null && !lastShaFound && 
!commits.isEmpty()) {
+                // the last routed commit is no longer on the branch (a force 
push or a reset to an older commit), and
+                // the newest commits were all routed before: continue from 
the newest one, so that the next polls do
+                // not read the remembered number of commits again to look for 
the last routed one
+                lastSha = commits.get(0).getSHA1();

Review Comment:
   When the last routed commit has disappeared from the branch (force push, 
branch reset), `lastSha` is silently updated to the newest visible commit with 
no log output. This is a significant operational event: users investigating why 
commits stopped routing after a force push would have no diagnostic trail.
   
   Add a `LOG.info` before the assignment:
   
   ```java
   LOG.info("Last routed commit {} is no longer on branch {}, continuing from 
the newest commit {}",
            lastSha, branchName, commits.get(0).getSHA1());
   lastSha = commits.get(0).getSHA1();
   ```



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