Skip to content

Commit 0414f5c

Browse files
committed
add: register resolver
1 parent ca419fb commit 0414f5c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

discovery/watcher.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"context"
88
"errors"
99
"fmt"
10+
"google.golang.org/grpc/resolver"
1011
"sync"
1112
"sync/atomic"
1213
"time"
@@ -146,7 +147,6 @@ func NewWatcher(ctx context.Context, config Config, log hclog.Logger) (*Watcher,
146147
Timeout: 30 * time.Second,
147148
}),
148149
// note: experimental apis
149-
grpc.WithResolvers(w.resolver),
150150
grpc.WithConnectParams(grpc.ConnectParams{
151151
Backoff: backoff2.DefaultConfig,
152152
MinConnectTimeout: 10 * time.Second,
@@ -157,6 +157,8 @@ func NewWatcher(ctx context.Context, config Config, log hclog.Logger) (*Watcher,
157157
// [1]: https://github.com/grpc/grpc/blob/master/doc/load-balancing.md#pick_first
158158
}
159159

160+
resolver.Register(w.resolver)
161+
160162
// Dial with "consul://" to trigger our custom resolver. We don't
161163
// provide a server address. The connection will be updated by the
162164
// Watcher via the custom resolver once an address is known.

0 commit comments

Comments
 (0)