From 6743180b0f127c9b324d46586273d922ebd003a9 Mon Sep 17 00:00:00 2001 From: Jesse Schmidt Date: Wed, 26 Jun 2024 10:08:50 -0700 Subject: [PATCH] fix verbose requirement for unmerged record count --- cmd/listIndex.go | 52 +++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 27 deletions(-) diff --git a/cmd/listIndex.go b/cmd/listIndex.go index 2e81f5b..5bd334e 100644 --- a/cmd/listIndex.go +++ b/cmd/listIndex.go @@ -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)