Skip to content

chore: create and reuse a base CallContext #3816

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 2 commits into from
Apr 15, 2025
Merged

Conversation

olavloite
Copy link
Collaborator

@olavloite olavloite commented Apr 11, 2025

Every RPC that is executed by the client needs to create a new CallContext. Some of the settings in this CallContext is the same for all calls, and there is no need to create a new one completely from scratch for the properties that are the same for all calls. This change creates a base CallContext that is reused as the base for all RPCs.

Each of the withSomething(..) methods in GrpcCallContext creates a new GrpcCallContext. Skipping as many of these withSomething(..) calls in each request therefore saves a bit of memory allocation.

Every RPC that is executed by the client needs to create a new CallContext. Some
of the settings in this CallContext is the same for all calls, and there is no
need to create a new one completely from scratch for the properties that are the
same for all calls. This change creates a base CallContext that is reused as the
base for all RPCs.
@olavloite olavloite requested review from a team as code owners April 11, 2025 14:48
@product-auto-label product-auto-label bot added size: s Pull request size is small. api: spanner Issues related to the googleapis/java-spanner API. labels Apr 11, 2025
@olavloite olavloite merged commit 8919c5e into main Apr 15, 2025
34 checks passed
@olavloite olavloite deleted the base-grpc-call-context branch April 15, 2025 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: spanner Issues related to the googleapis/java-spanner API. size: s Pull request size is small.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants