chore: do not mutate Config.GrpcOptions when creating a client - #151
Merged
Anush008 merged 2 commits intoSep 5, 2026
Merged
Conversation
NewGrpcClient wrote the combined dial options back into the caller's Config.GrpcOptions. Reusing one Config to create a second client then duplicated every default option, chaining the retry and metadata interceptors again per client created and multiplying retry attempts and backoff. Keep the combined slice local so the caller's config is left untouched.
Anush008
reviewed
Sep 5, 2026
Member
|
Thanks for taking the time to contribute @Tyagiquamar |
Contributor
Author
|
Done — removed the separate test file and fixed the lint issue. CI is green now. Thanks for the review. |
Anush008
approved these changes
Sep 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
NewGrpcClientassigned the combined dial options back into the caller'sConfig.GrpcOptions. Reusing the sameConfigtherefore accumulated the internally-added default options across client constructions and also mutated caller-owned configuration.Fix
Build the combined dial options in a local slice and pass that to
grpc.NewClientwithout modifyingconfig.GrpcOptions. This keeps repeated client construction idempotent while preserving user-provided gRPC options.