2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-22 12:55:18 +00:00

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

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 {