Reset flush strategy after client request is written #3103
Merged
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.
Motivation:
Currently we reset the flush strategy after a request is written and its response is received. If client starts writing another pipelined request on the same connection, it ends up using an overridden flush strategy of the previous request that is still waiting for its response.
Modifications:
beforeFinally
we guarantee that reset will happen before any retry/repeat operator initiates a new request on the same connection. It's safe to use "before" because for in-flight request the effectiveFlushStrategy
is captured at the beginning of the write and doesn't change regardless of the reset. Only a new request will see the effect of the reset.FlushStrategyOnClientTest
.FlushStrategyOnServerTest
to useTransportObserver
to observe flushes. This helps to use a realHttpServerContext
instead of faking aServerContext
and reuse code forFlushStrategyOnClientTest
.Cancellable
inNettyHttpServer
to highlight it's responsible for reset of FlushStrategy.Result:
Second pipelined request on the same connection uses its own
FlushStrategy
.