markap14 commented on a change in pull request #5042:
URL: https://github.com/apache/nifi/pull/5042#discussion_r625985326



##########
File path: 
nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/s3/ListS3.java
##########
@@ -448,17 +449,18 @@ public void onTrigger(final ProcessContext context, final 
ProcessSession session
         }
 
         final Set<String> updatedKeys = new HashSet<>();
-        if (latestListedTimestampInThisCycle <= currentTimestamp) {
-            updatedKeys.addAll(currentKeys);
+        if (latestListedTimestampInThisCycle <= currentTimestamp.get()) {
+            updatedKeys.addAll(currentKeys.get());
         }
         updatedKeys.addAll(listedKeys);
 
         persistState(session, latestListedTimestampInThisCycle, updatedKeys);
-        session.commit();
 
-        // Update currentKeys.
-        currentKeys = updatedKeys;
-        currentTimestamp = latestListedTimestampInThisCycle;
+        final long latestListed = latestListedTimestampInThisCycle;
+        session.commitAsync(() -> {
+            this.currentKeys.set(updatedKeys);

Review comment:
       That's a great catch. I suppose it could, potentially. I'll have to 
address this.




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to