Skip to content
This repository has been archived by the owner on Mar 19, 2024. It is now read-only.

deps: update consul-server-connection-manager #484

Merged
merged 4 commits into from
Jan 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ require (
github.com/golang/mock v1.6.0
github.com/golangci/golangci-lint v1.50.1
github.com/google/uuid v1.3.0
github.com/hashicorp/consul-server-connection-manager v0.1.1-0.20221115222743-242744ae73fb
github.com/hashicorp/consul-server-connection-manager v0.1.1
github.com/hashicorp/consul/api v1.18.0
github.com/hashicorp/consul/proto-public v0.2.1
github.com/hashicorp/consul/sdk v0.13.0
Expand Down
6 changes: 6 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,12 @@ github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t
github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
github.com/hashicorp/consul-server-connection-manager v0.1.1-0.20221115222743-242744ae73fb h1:bbbNb5f4PFoKLSRREYb/YKjrTtt7MHEqffGW+Tjx25o=
github.com/hashicorp/consul-server-connection-manager v0.1.1-0.20221115222743-242744ae73fb/go.mod h1:XVVlO+Yk7aiRpspiHZkrrFVn9BJIiOPnQIzqytPxGaU=
github.com/hashicorp/consul-server-connection-manager v0.1.1-0.20230118215633-3b2a49b39662 h1:rBNbZ2GUD62hUd0Xy8wNIAtyjHLzs8miuFELkSWyzJI=
github.com/hashicorp/consul-server-connection-manager v0.1.1-0.20230118215633-3b2a49b39662/go.mod h1:pp2hlwmFacV4hMhD5iu9Hppfk+iaDlbMsIWLgWntchM=
github.com/hashicorp/consul-server-connection-manager v0.1.1-0.20230120153659-f9b5452b527e h1:HX+AsjeFL84774gThBMYGRPqbp9ftzI8+sktIopo2sc=
github.com/hashicorp/consul-server-connection-manager v0.1.1-0.20230120153659-f9b5452b527e/go.mod h1:0jIi+bPKHXBhJi3iF9vGihsxssXj+u1/8+hvql4iVkY=
github.com/hashicorp/consul-server-connection-manager v0.1.1 h1:uLL+56/qMTU2cYbTqJqqJ02L1TIgNdQZMo7f6MHExUI=
github.com/hashicorp/consul-server-connection-manager v0.1.1/go.mod h1:0jIi+bPKHXBhJi3iF9vGihsxssXj+u1/8+hvql4iVkY=
github.com/hashicorp/consul/api v1.18.0 h1:R7PPNzTCeN6VuQNDwwhZWJvzCtGSrNpJqfb22h3yH9g=
github.com/hashicorp/consul/api v1.18.0/go.mod h1:owRRGJ9M5xReDC5nfT8FTJrNAPbT4NM6p/k+d03q2v4=
github.com/hashicorp/consul/proto-public v0.2.1 h1:9dZGW68IEuajEkaAAdXCUovVuKyccBOS0jub4Gee5II=
Expand Down
17 changes: 0 additions & 17 deletions internal/consul/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,6 @@ import (
"github.com/hashicorp/go-hclog"
)

var (
// Calling discovery.NewWatcher registers a new gRPC load balancer
// type tied to the consul:// scheme, which calls the global
// google.golang.org/grpc/balancer.Register, which, as specified
// in their docs is not threadsafe and should be called only in an
// init function. This mutex makes it so we can boot up multiple watchers
// particularly in our tests.
globalWatcherMutex sync.Mutex
)

type PeeringClient interface {
Read(ctx context.Context, name string, q *api.QueryOptions) (*api.Peering, *api.QueryMeta, error)
}
Expand Down Expand Up @@ -64,7 +54,6 @@ type ClientConfig struct {
}

type client struct {
stop func()
config ClientConfig
client *api.Client
token string
Expand All @@ -85,7 +74,6 @@ func (c *client) Wait(until time.Duration) error {
case err := <-c.initialized:
return err
case <-time.After(until):
c.stop()
return errors.New("did not get state within time limit")
}
}
Expand Down Expand Up @@ -138,9 +126,6 @@ func (c *client) WatchServers(ctx context.Context) error {
return nil
}

ctx, cancel := context.WithCancel(ctx)
c.stop = cancel

var static bool
serverName := c.config.Addresses
if strings.Contains(serverName, "=") {
Expand All @@ -162,9 +147,7 @@ func (c *client) WatchServers(ctx context.Context) error {
config.TLS = c.config.TLS
}

globalWatcherMutex.Lock()
watcher, err := discovery.NewWatcher(ctx, config, c.config.Logger)
globalWatcherMutex.Unlock()

if err != nil {
c.initialized <- err
Expand Down