Skip to content

Commit b8ca292

Browse files
authored
examples/features/retry: Improve docstring (#7331)
1 parent f1b7f41 commit b8ca292

File tree

1 file changed

+5
-7
lines changed
  • examples/features/retry/client

1 file changed

+5
-7
lines changed

examples/features/retry/client/main.go

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,14 @@ var (
4747
}]}`
4848
)
4949

50-
// use grpc.WithDefaultServiceConfig() to set service config
51-
func retryDial() (*grpc.ClientConn, error) {
52-
return grpc.NewClient(*addr, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithDefaultServiceConfig(retryPolicy))
53-
}
54-
5550
func main() {
5651
flag.Parse()
5752

58-
// Set up a connection to the server.
59-
conn, err := retryDial()
53+
// Set up a connection to the server with service config and create the channel.
54+
// However, the recommended approach is to fetch the retry configuration
55+
// (which is part of the service config) from the name resolver rather than
56+
// defining it on the client side.
57+
conn, err := grpc.NewClient(*addr, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithDefaultServiceConfig(retryPolicy))
6058
if err != nil {
6159
log.Fatalf("did not connect: %v", err)
6260
}

0 commit comments

Comments
 (0)