examples/features/retry: Improve docstring (#7331)

This commit is contained in:
Abhishek Ranjan 2024-06-21 19:32:47 +05:30 committed by GitHub
parent f1b7f4132e
commit b8ca2922f3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 7 deletions

View File

@ -47,16 +47,14 @@ var (
}]}`
)
// use grpc.WithDefaultServiceConfig() to set service config
func retryDial() (*grpc.ClientConn, error) {
return grpc.NewClient(*addr, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithDefaultServiceConfig(retryPolicy))
}
func main() {
flag.Parse()
// Set up a connection to the server.
conn, err := retryDial()
// Set up a connection to the server with service config and create the channel.
// 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.
conn, err := grpc.NewClient(*addr, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithDefaultServiceConfig(retryPolicy))
if err != nil {
log.Fatalf("did not connect: %v", err)
}