Skip to content

Commit

Permalink
chore: fix path walk warn when tmp rename (#82)
Browse files Browse the repository at this point in the history
* chore: fix path walk warn when tmp rename

* docs: update release-notes
  • Loading branch information
luohf-infinilabs authored Feb 19, 2025
1 parent 713f9f8 commit d5a3c7e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
4 changes: 2 additions & 2 deletions docs/content.en/docs/release-notes/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ Information about release notes of INFINI Framework is provided here.

### Bug fix
- Fixed `[]byte` operator when queue comsumer paic (#77)
- Fix incorrect interval configuration in index stats collection task (#80)
- Fixed incorrect interval configuration in index stats collection task (#80)
- Fixed reload file need use privious pos (#79)
- Fixed nil panic by init cluster health default status to green (#81)

- Fixed path walk warn when tmp rename (#82)

### Improvements

Expand Down
19 changes: 13 additions & 6 deletions lib/status/path.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
package status

import (
"infini.sh/framework/core/errors"
"infini.sh/framework/core/global"
"infini.sh/framework/core/util"
"os"
"path/filepath"
"strings"
"time"

"infini.sh/framework/core/errors"
"infini.sh/framework/core/global"
"infini.sh/framework/core/util"
)

// DiskFsType represents the type of a file system.
Expand All @@ -33,15 +34,21 @@ type DiskFs struct {

func DirSize(path string) (uint64, error) {
var size int64
err := filepath.Walk(path, func(_ string, info os.FileInfo, err error) error {
err := filepath.Walk(path, func(filePath string, info os.FileInfo, err error) error {
if err != nil {
return err
if filePath == path {
return err
}
// continue to walk the directory and ignore the error
return nil
}

if !info.IsDir() {
size += info.Size()
}
return err
return nil
})

return uint64(size), err
}

Expand Down

0 comments on commit d5a3c7e

Please sign in to comment.