dpol1 commented on code in PR #1833:
URL: https://github.com/apache/stormcrawler/pull/1833#discussion_r2974004381


##########
external/solr/src/main/java/org/apache/stormcrawler/solr/SolrConnection.java:
##########
@@ -195,29 +187,27 @@ private void flushUpdates(
         }
 
         UpdateRequest updateRequest = new UpdateRequest();
-        updateRequest.add(docs);
-        updateRequest.deleteById(deletionIds);
+        if (!docs.isEmpty()) {
+            updateRequest.add(docs);
+        }
+        if (!deletionIds.isEmpty()) {
+            updateRequest.deleteById(deletionIds);
+        }
 
         List<Update> batch = new ArrayList<>(waitingUpdates);
         waitingUpdates.clear();
 
-        // Get the async client
-        LBHttp2SolrClient lbHttp2SolrClient = 
cloudHttp2SolrClient.getLbClient();
-        LBSolrClient.Req req = new LBSolrClient.Req(updateRequest, endpoints);
-
-        lbHttp2SolrClient
-                .requestAsync(req)
-                .whenComplete(
-                        (futureResponse, throwable) -> {
-                            if (throwable != null) {
-                                LOG.error("Exception caught while updating", 
throwable);
-
-                                // The request failed => add the batch back to 
the pending updates
-                                synchronized (lock) {
-                                    waitingUpdates.addAll(batch);
-                                }
-                            }
-                        });
+        CompletableFuture.runAsync(

Review Comment:
   Ah, I stand corrected — the cast is indeed unavoidable here. Thanks for 
linking that PR, it really helped me understand the API design issue in depth. 
I've just pushed the update, I took the liberty of leaving a short note for 
future migrations.



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