Skip to content

Commit f6f4e19

Browse files
committed
Handle any errors from the BatchObjectIter subprocess
1 parent 8d9be87 commit f6f4e19

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

sizes/graph.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,11 @@ func ScanRepositoryUsingGraph(
174174
if err != nil {
175175
return HistorySize{}, err
176176
}
177-
defer objectIter.Close()
177+
defer func() {
178+
if objectIter != nil {
179+
objectIter.Close()
180+
}
181+
}()
178182

179183
go func() {
180184
defer objectIn.Close()
@@ -313,6 +317,12 @@ func ScanRepositoryUsingGraph(
313317
return HistorySize{}, err
314318
}
315319

320+
err = objectIter.Close()
321+
objectIter = nil
322+
if err != nil {
323+
return HistorySize{}, err
324+
}
325+
316326
progressMeter.Start("Processing references: %d")
317327
for _, ref := range refs {
318328
progressMeter.Inc()

0 commit comments

Comments
 (0)