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

Apply optimized execution strategy for converted connections #2634

Merged
merged 3 commits into from
Jul 4, 2023

Conversation

idelpivnitskiy
Copy link
Member

@idelpivnitskiy idelpivnitskiy commented Jun 30, 2023

Motivation:

When a client is converted to a different API, the API optimizes the default strategy. We should do the same when we convert a reserved connection to a different API.

Modifications:

  • Apply an execution strategy inside the request method of every ReservedStreamingHttpConnectionToReserved*HttpConnection;

Result:

Converted connections apply the same strategy as converted clients.

Motivation:

When client is converted to a different API, the API optimizes default
strategy. We should do the same when we convert a reserved connection
to a different API.

Modifications:

- Apply an execution strategy inside request method of every
`ReservedStreamingHttpConnectionToReserved*HttpConnection`;

Result:

Converted connections apply the same strategy as converted clients.
@@ -144,6 +145,7 @@ public <T> BlockingIterable<? extends T> transportEventIterable(final HttpEventK

@Override
public HttpResponse request(final HttpRequest request) throws Exception {
request.context().putIfAbsent(HTTP_EXECUTION_STRATEGY_KEY, strategy);
Copy link
Member Author

Choose a reason for hiding this comment

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

Sorry, I don't have cycles right now to deal with ClientEffectiveStrategyTest.
I've verified locally that it works as expected after my fix and filed #2635.
The idea is that the request method for every ReservedStreamingHttpConnectionToReserved*HttpConnection should behave the same way as its top-level StreamingHttpClientTo*HttpClient.

Copy link
Member

@Scottmitch Scottmitch Jun 30, 2023

Choose a reason for hiding this comment

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

can you add some comments clarifying why and maybe an internal static utility function that makes it easier to track?

@@ -144,6 +145,7 @@ public <T> BlockingIterable<? extends T> transportEventIterable(final HttpEventK

@Override
public HttpResponse request(final HttpRequest request) throws Exception {
request.context().putIfAbsent(HTTP_EXECUTION_STRATEGY_KEY, strategy);
Copy link
Member

@Scottmitch Scottmitch Jun 30, 2023

Choose a reason for hiding this comment

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

can you add some comments clarifying why and maybe an internal static utility function that makes it easier to track?

@idelpivnitskiy idelpivnitskiy merged commit e257614 into apple:main Jul 4, 2023
@idelpivnitskiy idelpivnitskiy deleted the strategy branch July 4, 2023 00:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants