Skip to content

Commit 6f6c101

Browse files
committed
PMM-14431 Remove defer from cursor.
1 parent 5765b08 commit 6f6c101

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

exporter/metrics.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,6 @@ func GetAllIndexesForCollections(ctx context.Context, client *mongo.Client, coll
322322
if err != nil {
323323
continue // skip collections where indexes cannot be listed (e.g., views, system collections)
324324
}
325-
defer cursor.Close(ctx) //nolint:errcheck
326325

327326
for cursor.Next(ctx) {
328327
var indexDoc struct {
@@ -333,6 +332,7 @@ func GetAllIndexesForCollections(ctx context.Context, client *mongo.Client, coll
333332
}
334333
indexNames = append(indexNames, indexDoc.Name)
335334
}
335+
cursor.Close(ctx) //nolint:errcheck
336336
}
337337

338338
return indexNames, nil

0 commit comments

Comments
 (0)