Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 9940a91

Browse files
author
daveaugustus
committedMar 20, 2025·
test fixed
Signed-off-by: daveaugustus <pappu.kumar@progress.com>
1 parent 360882d commit 9940a91

File tree

1 file changed

+8
-3
lines changed
  • components/ingest-service/server

1 file changed

+8
-3
lines changed
 

‎components/ingest-service/server/chef.go

+8-3
Original file line numberDiff line numberDiff line change
@@ -247,9 +247,9 @@ func (s *ChefIngestServer) ProcessNodeDelete(ctx context.Context,
247247
return &response.ProcessNodeDeleteResponse{}, nil
248248
}
249249

250-
func (s *ChefIngestServer) GetIndicesEligableForReindexing() (map[string]backend.IndexSettingsVersion, error) {
250+
func (s *ChefIngestServer) GetIndicesEligableForReindexing(ctx context.Context) (map[string]backend.IndexSettingsVersion, error) {
251251
var eligableIndices = make(map[string]backend.IndexSettingsVersion)
252-
indices, err := s.client.GetIndices(context.Background())
252+
indices, err := s.client.GetIndices(ctx)
253253
if err != nil {
254254
return nil, status.Errorf(codes.Internal, "failed to fetch indices: %s", err)
255255
}
@@ -277,13 +277,18 @@ OuterLoop:
277277
eligableIndices[index.Index] = *versionSettings
278278
}
279279

280+
if len(eligableIndices) == 0 {
281+
log.Info("No indices are eligable for reindexing")
282+
return nil, status.Errorf(codes.NotFound, "no indices are eligable for reindexing")
283+
}
284+
280285
return eligableIndices, nil
281286
}
282287

283288
func (s *ChefIngestServer) StartReindex(ctx context.Context, req *ingest.StartReindexRequest) (*ingest.StartReindexResponse, error) {
284289
log.Info("Received request to start reindexing")
285290

286-
indices, err := s.GetIndicesEligableForReindexing()
291+
indices, err := s.GetIndicesEligableForReindexing(ctx)
287292

288293
if err != nil {
289294
return nil, status.Errorf(codes.Internal, "failed to fetch indices: %s", err)

0 commit comments

Comments
 (0)
Please sign in to comment.