You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by "stillalex (via GitHub)" <gi...@apache.org> on 2023/04/26 15:11:30 UTC

[GitHub] [solr] stillalex commented on a diff in pull request #1565: SOLR-13605: HttpSolrClient.Builder.withHttpClient() is useless for the purpose of setting client scoped so/connect timeouts

stillalex commented on code in PR #1565:
URL: https://github.com/apache/solr/pull/1565#discussion_r1178026053


##########
solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrClient.java:
##########
@@ -168,6 +168,12 @@ protected HttpSolrClient(Builder builder) {
       this.internalClient = false;
       this.followRedirects = builder.followRedirects;
       this.httpClient = builder.httpClient;
+      // The getParams() is not supported by this httpClient type!  Throws exception.
+      // this.soTimeout = builder.httpClient..getIntParameter(HttpClientUtil.PROP_SO_TIMEOUT,
+      // Math.toIntExact(builder.socketTimeoutMillis));
+      // this.connectionTimeout =
+      // builder.httpClient.getParams().getIntParameter(HttpClientUtil.PROP_CONNECTION_TIMEOUT,
+      // Math.toIntExact(builder.connectionTimeoutMillis));

Review Comment:
   this can be 
   ```
         if(this.httpClient instanceof Configurable) {
           RequestConfig conf = ((Configurable) httpClient).getConfig();
           this.connectionTimeout = conf.getConnectTimeout();
           this.soTimeout = conf.getSocketTimeout();
         }
   ```
   
   but also need to move the below from line 193 to the else branch on this if (line 185) so these 2 values only get set once
   ```
      this.connectionTimeout = Math.toIntExact(builder.connectionTimeoutMillis);
       this.soTimeout = Math.toIntExact(builder.socketTimeoutMillis);
   ```



-- 
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: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org