Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesse Schmidt committed Sep 20, 2024
1 parent 05c3c26 commit 460ce11
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions connection_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ type connectionProvider struct {
isLoadBalancer bool
token tokenManager
stopTendChan chan struct{}
initialized bool
closed atomic.Bool
}

Expand Down Expand Up @@ -172,8 +171,6 @@ func newConnectionProvider(
cp.logger.Debug("load balancer is enabled, not starting tend routine")
}

cp.initialized = true

return cp, nil
}

Expand All @@ -183,7 +180,7 @@ func (cp *connectionProvider) Close() error {
return nil
}

if !cp.isLoadBalancer && cp.initialized {
if !cp.isLoadBalancer {
cp.stopTendChan <- struct{}{}
<-cp.stopTendChan
}
Expand Down Expand Up @@ -348,6 +345,7 @@ func (cp *connectionProvider) connectToSeeds(ctx context.Context) error {
grpcConn, err := cp.createGrcpConn(seed)
if err != nil {
logger.ErrorContext(ctx, "failed to create connection", slog.Any("error", err))
grpcConn.Close()
return
}

Expand All @@ -363,7 +361,7 @@ func (cp *connectionProvider) connectToSeeds(ctx context.Context) error {
logger.WarnContext(ctx, "failed to refresh token", slog.Any("error", err))
authErr = err
tokenLock.Unlock()

grpcConn.Close()
return
}

Expand All @@ -380,6 +378,7 @@ func (cp *connectionProvider) connectToSeeds(ctx context.Context) error {
about, err := client.Get(ctx, &protos.AboutRequest{})
if err != nil {
logger.WarnContext(ctx, "failed to connect to seed", slog.Any("error", err))
grpcConn.Close()
return
}

Expand Down

0 comments on commit 460ce11

Please sign in to comment.