mirror of https://github.com/grpc/grpc-go.git
examples/features/retry: Improve docstring (#7331)
This commit is contained in:
parent
f1b7f4132e
commit
b8ca2922f3
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue