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


##########
components/camel-aws/camel-aws-secrets-manager/src/main/java/org/apache/camel/component/aws/secretsmanager/vault/CloudTrailReloadTriggerTask.java:
##########
@@ -263,6 +276,31 @@ protected void doShutdown() throws Exception {
         }
 
         updates.clear();
+        lastTime = null;
+        lastTimeEventIds.clear();
+    }
+
+    /**
+     * Adds every event with the given event name since the last check to the 
list, reading all pages.
+     */
+    private void lookupEvents(String eventName, List<Event> events) {
+        String nextToken = null;
+        do {
+            LookupEventsRequest.Builder eventsRequestBuilder = 
LookupEventsRequest.builder()
+                    .maxResults(LOOKUP_MAX_RESULTS)
+                    
.lookupAttributes(LookupAttribute.builder().attributeKey(LookupAttributeKey.EVENT_NAME)
+                            .attributeValue(eventName).build());
+            if (lastTime != null) {
+                // inclusive, so an event in the same second as the newest 
event seen is not skipped
+                eventsRequestBuilder.startTime(lastTime);

Review Comment:
   Good point, thanks. `doShutdown` sets `lastTime` to null, so a stop between 
two pages would send the next page without a start time, and the two event-name 
lookups should also share one start time. I will capture it once per check and 
pass it to both lookups in a small follow-up after this is merged, so the 
approved commit stays 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