Skip to content

Commit 9b9cb81

Browse files
Unified Storage Search: Check error first after building index (grafana#97504)
check error first after building index
1 parent 9e885ca commit 9b9cb81

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pkg/storage/unified/resource/search.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,10 @@ func (s *searchSupport) build(ctx context.Context, nsr NamespacedResource, size
355355
return rv, err
356356
})
357357

358+
if err != nil {
359+
return nil, 0, err
360+
}
361+
358362
// Record the number of objects indexed for the kind/resource
359363
docCount, err := index.DocCount()
360364
if err != nil {
@@ -364,10 +368,6 @@ func (s *searchSupport) build(ctx context.Context, nsr NamespacedResource, size
364368
IndexMetrics.IndexedKinds.WithLabelValues(key.Resource).Add(float64(docCount))
365369
}
366370

367-
if err != nil {
368-
return nil, 0, err
369-
}
370-
371371
if err == nil {
372372
err = index.Flush()
373373
}

0 commit comments

Comments
 (0)