mreutegg commented on code in PR #920:
URL: https://github.com/apache/jackrabbit-oak/pull/920#discussion_r1206672062


##########
oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/ThrottlingDocumentStoreWrapper.java:
##########
@@ -190,6 +191,20 @@ public <T extends Document> T findAndUpdate(final 
Collection<T> collection, fina
         return oldDoc;
     }
 
+    @Override
+    @NotNull
+    public <T extends Document> List<T> findAndUpdate(@NotNull Collection<T> 
collection, @NotNull List<UpdateOp> updateOps) {
+        final long throttlingTime = performThrottling(collection);
+        final List<T> results = new ArrayList<>();
+        try {
+            results.addAll(store.findAndUpdate(collection, updateOps));
+        } finally {
+            
throttlingStatsCollector.doneFindAndModify(MILLISECONDS.toNanos(throttlingTime),
 collection,
+                    updateOps.stream().map(UpdateOp::getId).collect(toList()), 
true, 0);
+        }
+        return results;

Review Comment:
   Adding documents to `results` is unnecessary.
   ```suggestion
           final long throttlingTime = performThrottling(collection);
           try {
               return store.findAndUpdate(collection, updateOps);
           } finally {
               
throttlingStatsCollector.doneFindAndModify(MILLISECONDS.toNanos(throttlingTime),
 collection,
                       
updateOps.stream().map(UpdateOp::getId).collect(toList()), false, true, 0);
           }
   ```



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