feat: Add request_timeout, a parameter as optional to cluster::request()
which allows user to set http_client::timeout
and add error message for request timeouts
#1186
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
At now,
cluster::request
can't accept HTTP requests that require a long time to wait for response, especially which takes over 5 seconds. That's because there's no option to sethttp_client::timeout
as user want. So, I added the optional parameterrequest_timeout
to set it.When an user calls
cluster::request()
, It would be passed throughcluster::request()
->http_request::request_timeout
(what I added in this commit) ->http_client::timeout
And also,
http_request::run
is printingMalformed HTTP response
when request has timed out, so I fix it to print a log "Timed out while waiting for the response". For this, I needed to add a public member variable to http_client,timed_out
which would be set byhttps_client::one_second_timer()
Code change checklist