Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com>
  • Loading branch information
timvaillancourt committed Feb 7, 2025
1 parent 27e00e6 commit c84eee4
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions go/vt/vtorc/logic/tablet_discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ func OpenTabletDiscovery() <-chan time.Time {

// getAllTablets gets all tablets from all cells using a goroutine per cell. It returns a map of
// cells (string) to slices of tablets (as topo.TabletInfo) and a slice of cells (string) that
// failed to return as a result.
// failed to return a result.
func getAllTablets(ctx context.Context, cells []string) (map[string][]*topo.TabletInfo, []string) {
var mu sync.Mutex
failedCells := make([]string, 0, len(cells))
Expand All @@ -173,7 +173,9 @@ func getAllTablets(ctx context.Context, cells []string) (map[string][]*topo.Tabl
})
}
_ = eg.Wait() // always nil
slices.Sort(failedCells)
if len(failedCells) > 1 {
slices.Sort(failedCells)
}
return tabletsByCell, failedCells
}

Expand All @@ -187,9 +189,9 @@ func refreshAllTablets(ctx context.Context) error {
// refreshTabletsUsing refreshes tablets using a provided loader.
func refreshTabletsUsing(ctx context.Context, loader func(tabletAlias string), forceRefresh bool) error {
// Get all cells.
ctx, cancel := context.WithTimeout(ctx, topo.RemoteOperationTimeout)
defer cancel()
cells, err := ts.GetKnownCells(ctx)
cellsCtx, cellsCancel := context.WithTimeout(ctx, topo.RemoteOperationTimeout)
defer cellsCancel()
cells, err := ts.GetKnownCells(cellsCtx)
if err != nil {
return err
}
Expand Down

0 comments on commit c84eee4

Please sign in to comment.