Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SOLR-16435: Add Request timeout to Http2SolrClient #1046

Merged
merged 2 commits into from Oct 4, 2022

Conversation

tflobbe
Copy link
Member

@tflobbe tflobbe commented Sep 27, 2022

Adding the option to Http2SolrClient. For the Cloud client, users need to use withInternalClientBuilder and provide a builder, similar to how they use for setting the other timeouts, authentication, etc.

Will update CHANGES once this gets reviewed, but my plan is to merge into 9.x

@sonatype-lift
Copy link

sonatype-lift bot commented Sep 27, 2022

⚠️ 313 God Classes were detected by Lift in this project. Visit the Lift web console for more details.

@@ -519,7 +525,11 @@ private Request makeRequest(SolrRequest<?> solrRequest, String collection)

private void decorateRequest(Request req, SolrRequest<?> solrRequest) {
req.header(HttpHeader.ACCEPT_ENCODING, null);
req.timeout(idleTimeout, TimeUnit.MILLISECONDS);
if (requestTimeout > 0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If someone accidentally sets this to 0, we'd just be ignoring it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it makes much difference. 0 means timeout disabled, but our client will only wait for idleTimeout (see listener.get(idleTimeout, TimeUnit.MILLISECONDS);), so we'll timeout anyway, and at that point, probably better to timeout the request, since the client won't consume it anyway. WDYT?

@tflobbe tflobbe merged commit d70af45 into apache:main Oct 4, 2022
@tflobbe tflobbe deleted the request-timeout branch October 4, 2022 18:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants