Skip to content

Commit

Permalink
Fix error handling when warming up the id caches
Browse files Browse the repository at this point in the history
  • Loading branch information
aduffeck committed Aug 8, 2024
1 parent 375deb6 commit cc21efb
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions pkg/storage/fs/posix/tree/assimilation.go
Original file line number Diff line number Diff line change
Expand Up @@ -548,15 +548,15 @@ func (t *Tree) WarmupIDCache(root string, assimilate bool) error {

sizes := make(map[string]int64)
err := filepath.Walk(root, func(path string, info os.FileInfo, err error) error {
if err != nil {
return err
}

// skip lock files
if isLockFile(path) {
return nil
}

if err != nil {
return err
}

// calculate tree sizes
if !info.IsDir() {
dir := filepath.Dir(path)
Expand Down Expand Up @@ -601,12 +601,14 @@ func (t *Tree) WarmupIDCache(root string, assimilate bool) error {
}
return nil
})
if err != nil {
return err
}

for dir, size := range sizes {
_ = t.lookup.MetadataBackend().Set(context.Background(), dir, prefixes.TreesizeAttr, []byte(fmt.Sprintf("%d", size)))
}

if err != nil {
return err
}

return nil
}

0 comments on commit cc21efb

Please sign in to comment.