Skip to content

Commit ffac5da

Browse files
apply code review changes
Co-authored-by: Matt Dale <[email protected]>
1 parent 01c7555 commit ffac5da

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

internal/cmd/perfcomp/main.go

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,10 @@ func findRawData(version string, coll *mongo.Collection) ([]RawData, error) {
144144
{"info.task_name", "perf"},
145145
}
146146

147-
findOptions := options.Find()
148-
149147
findCtx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
150148
defer cancel()
151149

152-
cursor, err := coll.Find(findCtx, filter, findOptions)
150+
cursor, err := coll.Find(findCtx, filter)
153151
if err != nil {
154152
log.Panicf(
155153
"Error retrieving raw data for version %q: %v",
@@ -162,16 +160,13 @@ func findRawData(version string, coll *mongo.Collection) ([]RawData, error) {
162160
fmt.Printf("Successfully retrieved %d docs from version %s.\n", cursor.RemainingBatchLength(), version)
163161

164162
var rawData []RawData
165-
for cursor.Next(findCtx) {
166-
var rd RawData
167-
if err := cursor.Decode(&rd); err != nil {
168-
break
169-
}
170-
rawData = append(rawData, rd)
171-
}
172-
173-
if err == nil {
174-
err = cursor.Err()
163+
err = cursor.All(findCtx, &rawData)
164+
if err != nil {
165+
log.Panicf(
166+
"Error decoding raw data from version %q: %v",
167+
version,
168+
err,
169+
)
175170
}
176171
if err != nil {
177172
log.Panicf(

0 commit comments

Comments
 (0)