Skip to content
Permalink
Browse files

Added missing default Solr http client connection timeout initialization

Consistently with the custom Solr http client used for https connections
to remote Solr peers or to YaCy external Solr storage.

This prevent remote Solr requests threads to wait for establishing a
connection to a remote peer longer than the configured timeout.
  • Loading branch information...
luccioman committed May 24, 2018
1 parent fa4399d commit 0082b5ab2a0dc3130047657298049380631d1bf3
Showing with 5 additions and 0 deletions.
  1. +5 −0 source/net/yacy/cora/federate/solr/instance/RemoteInstance.java
@@ -235,7 +235,9 @@ protected HttpContext createHttpContext() {
}
};
org.apache.http.params.HttpParams params = result.getParams();
/* Set the maximum time to establish a connection to the remote server */
org.apache.http.params.HttpConnectionParams.setConnectionTimeout(params, timeout);
/* Set the maximum time between data packets reception one a connection has been established */
org.apache.http.params.HttpConnectionParams.setSoTimeout(params, timeout);
result.addRequestInterceptor(new HttpRequestInterceptor() {
@Override
@@ -361,6 +363,9 @@ public SolrClient getServer(String name) {
s = builder.build();
}
//s.setAllowCompression(true);
/* Set the maximum time to establish a connection to the remote server */
s.setConnectionTimeout(this.timeout);
/* Set the maximum time between data packets reception one a connection has been established */
s.setSoTimeout(this.timeout);
//s.setMaxRetries(1); // Solr-Doc: No more than 1 recommended (depreciated)
this.server.put(name, s);

0 comments on commit 0082b5a

Please sign in to comment.
You can’t perform that action at this time.