Skip to content

async client: refactor Http::AsyncClient::Callbacks to pass in Http::AsyncClient::Request* for correlation between requests and responses#10358

Merged
snowp merged 10 commits intoenvoyproxy:masterfrom
yskopets:refactoring/async-client-callbacks
Mar 23, 2020
Merged

async client: refactor Http::AsyncClient::Callbacks to pass in Http::AsyncClient::Request* for correlation between requests and responses#10358
snowp merged 10 commits intoenvoyproxy:masterfrom
yskopets:refactoring/async-client-callbacks

Conversation

@yskopets
Copy link
Member

Description: refactor Http::AsyncClient::Callbacks to pass in Http::AsyncClient::Request* for correlation between requests and responses
Risk Level: Low
Testing: unit tests
Docs Changes: N/A
Release Notes: N/A

Context:

Motivation:

  • let Callbacks implementations to be able to determine which of the multiple in-flight requests has changed it's status

@alyssawilk
Copy link
Contributor

cc @alyssawilk @mattklein123

…p::AsyncClient::Request*` for correlation between requests and responses

Signed-off-by: Yaroslav Skopets <yaroslav@tetrate.io>
…s` and `AsyncClient::RequestCallbacks`

Signed-off-by: Yaroslav Skopets <yaroslav@tetrate.io>
Copy link
Contributor

@snowp snowp left a comment

Choose a reason for hiding this comment

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

Thanks, this seems like the right direction. Couple comments

Signed-off-by: Yaroslav Skopets <yaroslav@tetrate.io>
Signed-off-by: Yaroslav Skopets <yaroslav@tetrate.io>
@yskopets yskopets force-pushed the refactoring/async-client-callbacks branch from b100a3e to 33db494 Compare March 17, 2020 21:01
@yskopets yskopets requested a review from snowp March 17, 2020 21:10
Signed-off-by: Yaroslav Skopets <yaroslav@tetrate.io>
Copy link
Contributor

@alyssawilk alyssawilk left a comment

Choose a reason for hiding this comment

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

One drive by question - do we have any tests of multiple requests + responses where we can regression test they're being correlated correctly?

@yskopets
Copy link
Member Author

@alyssawilk No, sorry, I don't have such a test.

I'll see what I can do.

…d responses

Signed-off-by: Yaroslav Skopets <yaroslav@tetrate.io>
Signed-off-by: Yaroslav Skopets <yaroslav@tetrate.io>
@yskopets
Copy link
Member Author

@alyssawilk I've added missing unit tests.

Copy link
Contributor

@snowp snowp left a comment

Choose a reason for hiding this comment

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

This looks good to me besides the one small comment.

@alyssawilk Does the testing story seem okay here or would you like to see an integration test?

const Http::AsyncClient::RequestOptions&) -> Http::AsyncClient::Request* {
callbacks.onFailure(Envoy::Http::AsyncClient::FailureReason::Reset);
callbacks.onFailure(request_, Envoy::Http::AsyncClient::FailureReason::Reset);
return nullptr;
Copy link
Contributor

Choose a reason for hiding this comment

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

should you be returning the request_ ptr here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually, I've decided to restore original return nullptr in all other places.

return nullptr affects the code path that follows AsyncClient::send(), so I shouldn't have changed it in the first place.

Signed-off-by: Yaroslav Skopets <yaroslav@tetrate.io>
@yskopets yskopets requested a review from snowp March 20, 2020 00:01
Signed-off-by: Yaroslav Skopets <yaroslav@tetrate.io>
Signed-off-by: Yaroslav Skopets <yaroslav@tetrate.io>
Copy link
Contributor

@snowp snowp left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@snowp snowp merged commit 95bbc54 into envoyproxy:master Mar 23, 2020
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.

3 participants