Skip to content

Commit dc1a866

Browse files
committed
revert: grcp.NewClient to grpc.DialContext to retain legacy behaviour
1 parent 4eac8c9 commit dc1a866

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

discovery/watcher.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,9 @@ func NewWatcher(ctx context.Context, config Config, log hclog.Logger) (*Watcher,
160160
// Dial with "consul://" to trigger our custom resolver. We don't
161161
// provide a server address. The connection will be updated by the
162162
// Watcher via the custom resolver once an address is known.
163-
conn, err := grpc.NewClient("consul://", dialOpts...)
163+
//nolint:staticcheck
164+
// We want to retain the legacy behavior of grpc.DialContext.
165+
conn, err := grpc.DialContext(ctx, "consul://", dialOpts...)
164166
if err != nil {
165167
return nil, err
166168
}
@@ -416,8 +418,6 @@ func (w *Watcher) nextServer(addrs *addrSet) error {
416418
func (w *Watcher) connect(addr Addr) (serverState, error) {
417419
w.log.Trace("Watcher.connect", "addr", addr)
418420

419-
w.conn.Connect()
420-
421421
// Tell the gRPC connection to switch to the selected server.
422422
w.log.Debug("switching to Consul server", "address", addr)
423423
err := w.switchServer(addr)

0 commit comments

Comments
 (0)