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


##########
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:
   Good call - but I’d avoid `CloudHttp2SolrClient` here since it’s an internal 
implementation detail in Solr 10. We should stay on `CloudSolrClient` and use 
the public API surface instead.



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