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


##########
components/camel-google/camel-google-storage/src/main/java/org/apache/camel/component/google/storage/GoogleCloudStorageConsumer.java:
##########
@@ -169,12 +173,44 @@ protected Queue<Exchange> createExchanges(List<Blob> 
blobList) {
             }
         } catch (Exception e) {
             LOG.warn("Error getting object due: {}", e.getMessage(), e);
+            // none of the objects of this poll is processed
+            releaseInProgress(answer);
             throw e;
         }
 
         return answer;
     }
 
+    private void addExchange(Blob blob, String key, Queue<Exchange> answer) {
+        // skip the object if an exchange of a previous poll is still 
processing it
+        if (!inProgress.add(key)) {

Review Comment:
   Confirmed and fixed in ec35d39b3e42. `poll()` now takes 
`Set.copyOf(inProgress)` before `list` / `get`
   (`GoogleCloudStorageConsumer.java:103`) and `addExchange` skips a key that 
is in that snapshot or already in progress
   (line 194). New `GoogleCloudStorageConsumerListingWindowTest` holds the 
listing (and, with `objectName`, the get) open
   with a `Storage` proxy until the in-flight exchange has completed (object 
deleted, name released), with
   `includeBody=false`: against the previous commit both cases route `a.txt` a 
second time, now once. No sleeps: the gate
   is the `ExchangeCompletedEvent` of the held exchange. The snapshot is per 
poll, so an object is never skipped for longer
   than one poll: with `deleteAfterRead=false`, or after a failed exchange, an 
object that was in flight when the poll
   started is consumed by the next poll instead of this one. Module suite: 61 
tests, 0 failures.
   
   _Claude Code on behalf of allthingssecurity_



##########
docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_23.adoc:
##########
@@ -3692,6 +3692,14 @@ When `downloadFileName` is fully dynamic and has no 
static directory prefix (for
 `downloadFileName=${file:name}`), a relative destination must stay within the 
working directory. An absolute
 destination that comes from the route's own expression is not confined.
 
+=== camel-google-storage - objects whose exchange is in flight

Review Comment:
   Done in ec35d39b3e42: the second heading is gone and the text is now the 
last paragraph of the existing
   `=== camel-google-storage` section.
   
   _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