Skip to content

feat: support with_call for wrapped rpcs #550

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

Merged
merged 4 commits into from
Nov 9, 2023
Merged

Conversation

daniel-sanche
Copy link
Contributor

Most grpc calls return a grpc.Call object, that contains trailing metadata and other useful information. You can then await (for async unary rpcs) or iterate over (for streaming rpcs) the Call object to get the proto results of the rpc.

This is not the case for unary synchronous calls, because there is no intermediate object. Calling the rpc results in the value directly. The grpc library provides with_call methods for this reason, which return a tuple of the rpc result and the Call object.

Currently, the gapic wrapper does not provide a way to access this data

This PR solves the issue by adding with_call to the wrap_method function, which will is passed down to the grpc callable

@daniel-sanche daniel-sanche requested review from a team as code owners November 9, 2023 20:32
@product-auto-label product-auto-label bot added the size: s Pull request size is small. label Nov 9, 2023
@vchudnov-g
Copy link
Contributor

@daniel-sanche Could you fix the lint error?

@daniel-sanche
Copy link
Contributor Author

@daniel-sanche Could you fix the lint error?

fixed, thanks

@daniel-sanche daniel-sanche merged commit 01a57a7 into main Nov 9, 2023
@daniel-sanche daniel-sanche deleted the support_with_call branch November 9, 2023 21:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: s Pull request size is small.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants