mvolikas commented on code in PR #1833:
URL: https://github.com/apache/stormcrawler/pull/1833#discussion_r2989612770
##########
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:
Yes, they explicitly
[mention](https://solr.apache.org/guide/solr/latest/upgrade-notes/major-changes-in-solr-10.html#solrj):
> `CloudHttp2SolrClient.Builder` has moved to `CloudSolrClient`; users
should generally have no need to refer to `CloudHttp2SolrClient` or any
class/member with "http2" in it. The builder will check if Jetty `HttpClient`
is available and use that, otherwise fallback on a JDK based `HttpClient`.
In my honest opinion, we are in one of those cases where you need to use the
more specific classes for both the cloud and http client.
--
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]