Skip to content

Commit

Permalink
fix verbose requirement for unmerged record count
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesse Schmidt committed Jun 26, 2024
1 parent 9221730 commit 6743180
Showing 1 changed file with 25 additions and 27 deletions.
52 changes: 25 additions & 27 deletions cmd/listIndex.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,35 +81,33 @@ func newListIndexCmd() *cobra.Command {

indexStatusList := make([]*protos.IndexStatusResponse, len(indexList.GetIndices()))

if listIndexFlags.verbose {
cancel()

ctx, cancel = context.WithTimeout(context.Background(), listIndexFlags.timeout)
defer cancel()

wg := sync.WaitGroup{}
for i, index := range indexList.GetIndices() {
wg.Add(1)
go func(i int, index *protos.IndexDefinition) {
defer wg.Done()
indexStatus, err := adminClient.IndexGetStatus(ctx, index.Id.Namespace, index.Id.Name)
if err != nil {
logger.ErrorContext(ctx,
"failed to get index status",
slog.Any("error", err),
slog.String("index", index.Id.String()),
)
return
}

indexStatusList[i] = indexStatus
logger.Debug("server index status", slog.Int("index", i), slog.Any("response", indexStatus))
}(i, index)
}

wg.Wait()
cancel()

ctx, cancel = context.WithTimeout(context.Background(), listIndexFlags.timeout)
defer cancel()

wg := sync.WaitGroup{}
for i, index := range indexList.GetIndices() {
wg.Add(1)
go func(i int, index *protos.IndexDefinition) {
defer wg.Done()
indexStatus, err := adminClient.IndexGetStatus(ctx, index.Id.Namespace, index.Id.Name)
if err != nil {
logger.ErrorContext(ctx,
"failed to get index status",
slog.Any("error", err),
slog.String("index", index.Id.String()),
)
return
}

indexStatusList[i] = indexStatus
logger.Debug("server index status", slog.Int("index", i), slog.Any("response", indexStatus))
}(i, index)
}

wg.Wait()

logger.Debug("server index list", slog.String("response", indexList.String()))

view.PrintIndexes(indexList, indexStatusList, listIndexFlags.verbose)
Expand Down

0 comments on commit 6743180

Please sign in to comment.