mirror of
https://github.com/octoleo/restic.git
synced 2024-12-26 12:27:33 +00:00
repository: MasterIndex.ListPacks / Index.EachByPack allow earlier GC
Allow earlier garbage collection of some of the intermediate data structures.
This commit is contained in:
parent
0d9ac78437
commit
6ff9517e45
@ -294,6 +294,8 @@ func (idx *Index) EachByPack(ctx context.Context, packBlacklist restic.IDSet) <-
|
||||
result.Blobs = append(result.Blobs, idx.toPackedBlob(e, restic.BlobType(typ)).Blob)
|
||||
}
|
||||
}
|
||||
// allow GC once entry is no longer necessary
|
||||
byPack[packID] = nil
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return
|
||||
|
@ -458,6 +458,8 @@ func (mi *MasterIndex) ListPacks(ctx context.Context, packs restic.IDSet) <-chan
|
||||
|
||||
// pass on packs
|
||||
for packID, pbs := range packBlob {
|
||||
// allow GC
|
||||
packBlob[packID] = nil
|
||||
select {
|
||||
case out <- restic.PackBlobs{PackID: packID, Blobs: pbs}:
|
||||
case <-ctx.Done():
|
||||
|
Loading…
Reference in New Issue
Block a user