Skip to content

Commit

Permalink
docs: fix and improve anti-patterns.md (#7418)
Browse files Browse the repository at this point in the history
  • Loading branch information
mtardy authored Jul 23, 2024
1 parent ac5a7fe commit aae9e64
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Documentation/anti-patterns.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ to create _a_ connection which may need to be recreated if it is lost.

`grpc.Dial` uses "passthrough" as the default name resolver for backward
compatibility while `grpc.NewClient` uses "dns" as its default name resolver.
This subtle diffrence is important to legacy systems that also specified a
This subtle difference is important to legacy systems that also specified a
custom dialer and expected it to receive the target string directly.

For these reasons, using `grpc.Dial` is discouraged. Even though it is marked
Expand Down Expand Up @@ -62,10 +62,10 @@ the RPC was sent to a server.

Some users of `Dial` use it as a way to validate the configuration of their
system. If you wish to maintain this behavior but migrate to `NewClient`, you
can call `State` and `WaitForStateChange` until the channel is connected.
However, if this fails, it does not mean that your configuration was bad - it
could also mean the service is not reachable by the client due to connectivity
reasons.
can call `GetState`, then `Connect` if the state is `Idle` and
`WaitForStateChange` until the channel is connected. However, if this fails,
it does not mean that your configuration was bad - it could also mean the
service is not reachable by the client due to connectivity reasons.

## Best practices for error handling in gRPC

Expand Down

0 comments on commit aae9e64

Please sign in to comment.