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

examples/features/retry: Improve docstring #7331

Merged
merged 3 commits into from
Jun 21, 2024
Merged

Conversation

aranjans
Copy link
Contributor

This issue #7275 talks about the example where the service config is being passed to the NewClient, but ideally the retry config should be accessed via the name resolver instead of defining it from client side. This PR adds the recommended approach.

RELEASE NOTES: n/a

@aranjans aranjans requested a review from purnesh42H June 18, 2024 07:30
@aranjans aranjans added the Type: Meta Github repo, process, etc label Jun 18, 2024
@aranjans aranjans added this to the 1.65 Release milestone Jun 18, 2024
@aranjans aranjans self-assigned this Jun 18, 2024
@@ -47,7 +47,9 @@ var (
}]}`
)

// use grpc.WithDefaultServiceConfig() to set service config
// use grpc.WithDefaultServiceConfig() to set service config. Ideal
Copy link
Contributor

Choose a reason for hiding this comment

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

slight improvement: "However, the recommended approach
is to fetch the retry configuration from the name resolver rather than defining it on the client side."

Copy link
Collaborator

Choose a reason for hiding this comment

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

I like purnesh' exact wording a bit more than what you ended up with.

Also, if this is a documentation string it goes above the function definition but it should start with retryDial as outlined in https://tip.golang.org/doc/comment, otherwise you shoud probably move it one line below, above grpc.Dial. While you're here, can you also replace retryDial with newClientWithRetries or something like that, since it doesn't use dial anymore?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thAnks @atollena, @purnesh42H for the detailed review, i have updated all the suggestion.

@zasweq zasweq changed the title Improve docstring examples/features/retry: Improve docstring Jun 18, 2024
@purnesh42H purnesh42H assigned aranjans and unassigned purnesh42H Jun 19, 2024
@aranjans aranjans assigned purnesh42H and atollena and unassigned aranjans Jun 19, 2024
Copy link
Contributor

@purnesh42H purnesh42H 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 for the fix.

@aranjans aranjans assigned easwars and unassigned atollena Jun 19, 2024
@aranjans aranjans requested a review from easwars June 19, 2024 10:26
// service config, and creates the channel. However, the recommended
// approach is to fetch the retry configuration from the name resolver
// rather than defining it on the client side.
func newClientWithRetries() (*grpc.ClientConn, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't understand the need for this function newClientWithRetries. I would recommend getting rid of it, and directly calling grpc.NewClient from main.

// use grpc.WithDefaultServiceConfig() to set service config
func retryDial() (*grpc.ClientConn, error) {
// newClientWithRetries uses grpc.WithDefaultServiceConfig() to set
// service config, and creates the channel. However, the recommended
Copy link
Contributor

Choose a reason for hiding this comment

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

A minor improvement:

However, the recommended approach is to fetch the retry configuration (which is part of the service config) from the name resolver rather than defining it on the client side.

@easwars easwars assigned aranjans and unassigned easwars and purnesh42H Jun 20, 2024
@aranjans aranjans assigned easwars and unassigned aranjans Jun 21, 2024
@easwars easwars merged commit b8ca292 into grpc:master Jun 21, 2024
11 checks passed
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Type: Meta Github repo, process, etc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants