You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by ho...@apache.org on 2022/04/05 00:53:57 UTC
[solr] 02/02: SOLR-16129: adjust timeAllowed -> setRequestTimeout hueristic to play nice with pathologically low values -- ex: timeAllowed=0
This is an automated email from the ASF dual-hosted git repository.
hossman pushed a commit to branch jira/solr-16129
in repository https://gitbox.apache.org/repos/asf/solr.git
commit f8e19b259fc520040d322584b94e08d5081c512e
Author: Chris Hostetter <ho...@apache.org>
AuthorDate: Mon Apr 4 17:42:32 2022 -0700
SOLR-16129: adjust timeAllowed -> setRequestTimeout hueristic to play nice with pathologically low values -- ex: timeAllowed=0
---
.../org/apache/solr/client/solrj/impl/Http2SolrClient.java | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2SolrClient.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2SolrClient.java
index d79449be931..95719b21ee8 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2SolrClient.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2SolrClient.java
@@ -1089,10 +1089,10 @@ public class Http2SolrClient extends SolrClient {
}
/**
- * If a <code>timeAllowed=X</code> is specified in the params, use (30ms + 2X) as a requestTimeout
- * on the response listener. This should give the remote node ample time to recognize it's
- * exceeded <code>timeAllowed</code> and response to the request, but if it doesn't then we want
- * to abort in a reasonably proportinate amount of time and not wait forever.
+ * If a <code>timeAllowed=X</code> is specified in the params, use <code>max(500ms, 2X)</code> as
+ * a requestTimeout on the response listener. This should give the remote node ample time to
+ * recognize it's exceeded <code>timeAllowed</code> and respond to the request, but if it doesn't
+ * then we want to abort in a reasonably proportinate amount of time and not wait forever.
*
* @see CommonParams#TIME_ALLOWED
*/
@@ -1102,7 +1102,7 @@ public class Http2SolrClient extends SolrClient {
final Long timeAllowed = params.getLong(CommonParams.TIME_ALLOWED);
if (null != timeAllowed) {
listener.setRequestTimeout(
- Instant.now().plusMillis(30).plusMillis(timeAllowed.longValue() * 2L));
+ Instant.now().plusMillis(Math.max(500, timeAllowed.longValue() * 2L)));
}
}
}