Unified Storage Search: Check error first after building index (#97504)

check error first after building index
This commit is contained in:
owensmallwood
2024-12-05 21:14:04 +02:00
committed by GitHub
parent 9e885cab7c
commit 9b9cb81199
+4 -4
View File
@@ -355,6 +355,10 @@ func (s *searchSupport) build(ctx context.Context, nsr NamespacedResource, size
return rv, err
})
if err != nil {
return nil, 0, err
}
// Record the number of objects indexed for the kind/resource
docCount, err := index.DocCount()
if err != nil {
@@ -364,10 +368,6 @@ func (s *searchSupport) build(ctx context.Context, nsr NamespacedResource, size
IndexMetrics.IndexedKinds.WithLabelValues(key.Resource).Add(float64(docCount))
}
if err != nil {
return nil, 0, err
}
if err == nil {
err = index.Flush()
}