mirror of
https://github.com/restic/restic.git
synced 2025-10-09 13:49:58 +00:00
copy/find/ls/recover/stats: Memorize snapshot listing before index
These commands filter the snapshots according to some criteria which essentially requires loading the index before filtering the snapshots. Thus create a copy of the snapshots list beforehand and use it later on.
This commit is contained in:
@@ -279,7 +279,7 @@ func (c *Checker) checkTreeWorker(ctx context.Context, trees <-chan restic.TreeI
|
||||
}
|
||||
|
||||
func loadSnapshotTreeIDs(ctx context.Context, repo restic.Repository) (ids restic.IDs, errs []error) {
|
||||
err := restic.ForAllSnapshots(ctx, repo, nil, func(id restic.ID, sn *restic.Snapshot, err error) error {
|
||||
err := restic.ForAllSnapshots(ctx, repo.Backend(), repo, nil, func(id restic.ID, sn *restic.Snapshot, err error) error {
|
||||
if err != nil {
|
||||
errs = append(errs, err)
|
||||
return nil
|
||||
|
@@ -587,7 +587,7 @@ func benchmarkSnapshotScaling(t *testing.B, newSnapshots int) {
|
||||
chkr, repo, cleanup := loadBenchRepository(t)
|
||||
defer cleanup()
|
||||
|
||||
snID, err := restic.FindSnapshot(context.TODO(), repo, "51d249d2")
|
||||
snID, err := restic.FindSnapshot(context.TODO(), repo.Backend(), "51d249d2")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
Reference in New Issue
Block a user