davsclaus commented on code in PR #27645:
URL: https://github.com/apache/camel/pull/27645#discussion_r4236604658


##########
components/camel-minio/src/main/java/org/apache/camel/component/minio/MinioConsumer.java:
##########
@@ -224,12 +225,37 @@ protected Deque<Exchange> 
createExchanges(Iterator<Result<Item>> minioObjectSumm
 
         } catch (Exception e) {
             LOG.warn("Error getting MinioObject due: {}", e.getMessage());
+            // none of the objects of this poll is processed
+            releaseInProgress(null, answer);
             throw e;
         }
 
         return answer;
     }
 
+    private void addExchange(String objectName, Deque<Exchange> answer) throws 
Exception {
+        // skip the object if an exchange of a previous poll is still 
processing it
+        if (!inProgress.add(objectName)) {
+            LOG.trace("Skipping object {} as it is already in progress", 
objectName);
+            return;
+        }
+        try {
+            answer.add(createExchange(objectName));

Review Comment:
   Non-blocking: the list→stat race is still there. If another consumer deletes 
the object between listing and `createExchange` (stat/get), the exception fails 
the whole poll and throws away the exchanges already collected. Catching 
`ErrorResponseException` with `errorResponse().code()` equal to `NoSuchKey`, 
then releasing the name and skipping the object instead of rethrowing, would 
close it. camel-aws2-s3 has the same gap, so this is fine as a follow-up.



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