-
Notifications
You must be signed in to change notification settings - Fork 5.3k
router: add per_try_idle_timeout configuration #18078
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
Changes from all commits
168b486
5045ee2
d50f4e6
4d2ba66
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -80,6 +80,10 @@ UpstreamRequest::~UpstreamRequest() { | |
| // Allows for testing. | ||
| per_try_timeout_->disableTimer(); | ||
| } | ||
| if (per_try_idle_timeout_ != nullptr) { | ||
| // Allows for testing. | ||
| per_try_idle_timeout_->disableTimer(); | ||
| } | ||
| if (max_stream_duration_timer_ != nullptr) { | ||
| max_stream_duration_timer_->disableTimer(); | ||
| } | ||
|
|
@@ -136,6 +140,7 @@ void UpstreamRequest::decode100ContinueHeaders(Http::ResponseHeaderMapPtr&& head | |
| void UpstreamRequest::decodeHeaders(Http::ResponseHeaderMapPtr&& headers, bool end_stream) { | ||
| ScopeTrackerScopeState scope(&parent_.callbacks()->scope(), parent_.callbacks()->dispatcher()); | ||
|
|
||
| resetPerTryIdleTimer(); | ||
| addResponseHeadersSize(headers->byteSize()); | ||
|
|
||
| // We drop 1xx other than 101 on the floor; 101 upgrade headers need to be passed to the client as | ||
|
|
@@ -177,6 +182,7 @@ void UpstreamRequest::decodeHeaders(Http::ResponseHeaderMapPtr&& headers, bool e | |
| void UpstreamRequest::decodeData(Buffer::Instance& data, bool end_stream) { | ||
| ScopeTrackerScopeState scope(&parent_.callbacks()->scope(), parent_.callbacks()->dispatcher()); | ||
|
|
||
| resetPerTryIdleTimer(); | ||
| maybeEndDecode(end_stream); | ||
| stream_info_.addBytesReceived(data.length()); | ||
| parent_.onUpstreamData(data, *this, end_stream); | ||
|
|
@@ -331,13 +337,32 @@ void UpstreamRequest::resetStream() { | |
| } | ||
| } | ||
|
|
||
| void UpstreamRequest::resetPerTryIdleTimer() { | ||
| if (per_try_idle_timeout_ != nullptr) { | ||
| per_try_idle_timeout_->enableTimer(parent_.timeout().per_try_idle_timeout_); | ||
| } | ||
| } | ||
|
|
||
| void UpstreamRequest::setupPerTryTimeout() { | ||
| ASSERT(!per_try_timeout_); | ||
| if (parent_.timeout().per_try_timeout_.count() > 0) { | ||
| per_try_timeout_ = | ||
| parent_.callbacks()->dispatcher().createTimer([this]() -> void { onPerTryTimeout(); }); | ||
| per_try_timeout_->enableTimer(parent_.timeout().per_try_timeout_); | ||
| } | ||
|
|
||
| ASSERT(!per_try_idle_timeout_); | ||
| if (parent_.timeout().per_try_idle_timeout_.count() > 0) { | ||
| per_try_idle_timeout_ = | ||
| parent_.callbacks()->dispatcher().createTimer([this]() -> void { onPerTryIdleTimeout(); }); | ||
| resetPerTryIdleTimer(); | ||
| } | ||
| } | ||
|
|
||
| void UpstreamRequest::onPerTryIdleTimeout() { | ||
| ENVOY_STREAM_LOG(debug, "upstream per try idle timeout", *parent_.callbacks()); | ||
| stream_info_.setResponseFlag(StreamInfo::ResponseFlag::StreamIdleTimeout); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If there's 2 tries (hedging or retries) but we successfully proxy, should the response flag be set?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is stream info on the upstream request (for upstream logs), not the downstream stream info. |
||
| parent_.onPerTryIdleTimeout(*this); | ||
| } | ||
|
|
||
| void UpstreamRequest::onPerTryTimeout() { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.