From 8526376e08f461cda71442bcfa720167219d8380 Mon Sep 17 00:00:00 2001 From: Julio Lopez Date: Tue, 17 Dec 2019 22:11:31 -0800 Subject: [PATCH] Close channel in the error case as well --- repo/content/content_manager_lock_free.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/repo/content/content_manager_lock_free.go b/repo/content/content_manager_lock_free.go index a3988ac53..4e7839840 100644 --- a/repo/content/content_manager_lock_free.go +++ b/repo/content/content_manager_lock_free.go @@ -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 }