Skip to content

Commit

Permalink
review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesse Schmidt committed Sep 26, 2024
1 parent e6f975f commit 4f35554
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
6 changes: 3 additions & 3 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ func (c *Client) WaitForIndexCompletion(
waitInterval time.Duration,
) error {
logger := c.logger.With(slog.String("namespace", namespace), slog.String("indexName", indexName))
logger.DebugContext(ctx, failedToWaitForIndexCompletion)
logger.DebugContext(ctx, "waiting for index completion")

conn, err := c.connectionProvider.GetRandomConn()
if err != nil {
Expand Down Expand Up @@ -703,9 +703,9 @@ func (c *Client) WaitForIndexCompletion(
select {
case <-timer.C:
case <-ctx.Done():
msg := "failed to wait for index completion"
msg := "waiting for index completion canceled"

logger.ErrorContext(ctx, "waiting for index completion canceled")
logger.ErrorContext(ctx, msg)

return NewAVSError(msg, ctx.Err())
}
Expand Down
10 changes: 9 additions & 1 deletion connection_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -530,11 +530,19 @@ func (cp *connectionProvider) getUpdatedEndpoints(ctx context.Context) map[uint6
}()

// Stores the endpoints from the node with the largest view of the cluster
// Think about a scenario where the nodes are split into two cluster
// momentarily and the client can see both. We are making the decision here
// to connect to the larger of the two formed cluster.
var largestNewCluster *idAndEndpoints
for cluster := range newClusterChan {
if largestNewCluster == nil || len(cluster.endpoints) > len(largestNewCluster.endpoints) {
largestNewCluster = cluster
cp.logger.DebugContext(ctx, "found new cluster ID", slog.Any("endpoints", largestNewCluster))
cp.logger.DebugContext(
ctx,
"largest cluster with new id",
slog.Any("endpoints", largestNewCluster.endpoints),
slog.Uint64("id", largestNewCluster.id),
)
}
}

Expand Down
2 changes: 1 addition & 1 deletion makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,5 @@ view-coverage: $(COVERAGE_DIR)/total.cov
go tool cover -html=$(COVERAGE_DIR)/total.cov

PHONY: lint
lint: $(GOLANGCI_LINT)
lint: $(GOLANGCI_LINT) mocks
$(GOLANGCI_LINT) run

0 comments on commit 4f35554

Please sign in to comment.