mirror of
https://github.com/prometheus/prometheus.git
synced 2026-05-05 04:16:15 +02:00
wal: ignore os.ErrNotExist errors in DirSize during WAL size calculation
This change updates `DirSize` to ignore `os.ErrNotExist` errors, since they are expected during normal WAL cleanup. All other errors continue to propagate. Fixes: #17005 Signed-off-by: Sujal Shah <sujalshah28092004@gmail.com>
This commit is contained in:
parent
25aee26a57
commit
17c58f5fce
@ -22,6 +22,10 @@ func DirSize(dir string) (int64, error) {
|
||||
var size int64
|
||||
err := filepath.Walk(dir, func(_ string, info os.FileInfo, err error) error {
|
||||
if err != nil {
|
||||
// Ignore missing files that may have been deleted during the walk.
|
||||
if os.IsNotExist(err) {
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
}
|
||||
if !info.IsDir() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user