check: Simplify referenced blob tracking

The result is identical as long as the context in not canceled. However,
in that case the result is incomplete anyways.
This commit is contained in:
Michael Eischer 2020-11-06 23:54:20 +01:00
parent 3500f9490c
commit 6da66c15d8
1 changed files with 2 additions and 4 deletions

View File

@ -520,6 +520,8 @@ func (c *Checker) filterTrees(ctx context.Context, backlog restic.IDs, loaderCha
c.blobRefs.Lock()
h := restic.BlobHandle{ID: nextTreeID, Type: restic.TreeBlob}
blobReferenced := c.blobRefs.M.Has(h)
// noop if already referenced
c.blobRefs.M.Insert(h)
c.blobRefs.Unlock()
if blobReferenced {
continue
@ -540,10 +542,6 @@ func (c *Checker) filterTrees(ctx context.Context, backlog restic.IDs, loaderCha
case loadCh <- nextTreeID:
outstandingLoadTreeJobs++
loadCh = nil
c.blobRefs.Lock()
h := restic.BlobHandle{ID: nextTreeID, Type: restic.TreeBlob}
c.blobRefs.M.Insert(h)
c.blobRefs.Unlock()
case j, ok := <-inCh:
if !ok {