Close channel in the error case as well

This commit is contained in:
Julio Lopez
2019-12-17 22:11:31 -08:00
committed by Jarek Kowalski
parent 2389abb465
commit 8526376e08

View File

@@ -163,6 +163,7 @@ func (bm *lockFreeManager) tryLoadPackIndexBlobsUnlocked(ctx context.Context, co
// unprocessedIndexBlobsUnlocked returns a closed channel filled with content IDs that are not in committedContents cache.
func (bm *lockFreeManager) unprocessedIndexBlobsUnlocked(contents []IndexBlobInfo) (resultCh <-chan blob.ID, totalSize int64, err error) {
ch := make(chan blob.ID, len(contents))
defer close(ch)
for _, c := range contents {
has, err := bm.committedContents.cache.hasIndexBlobID(c.BlobID)
@@ -179,8 +180,6 @@ func (bm *lockFreeManager) unprocessedIndexBlobsUnlocked(contents []IndexBlobInf
totalSize += c.Length
}
close(ch)
return ch, totalSize, nil
}