Skip to content

Commit

Permalink
fix(cdn): do not compute size from hidden directory (#5883)
Browse files Browse the repository at this point in the history
* fix(cdn): do not compute size from hidden directory

* fix: rename status
  • Loading branch information
sguiheux authored Jul 13, 2021
1 parent 6c07e41 commit b4d99f6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions engine/cdn/storage/nfs/nfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"io"
"os"
"path/filepath"
"strings"
"time"

"github.com/go-gorp/gorp"
Expand Down Expand Up @@ -185,8 +186,8 @@ func (n *Buffer) Status(_ context.Context) []sdk.MonitoringStatusLine {
Status: n.pingStatus,
},
{
Component: fmt.Sprintf("storage/%s/redis_dbsize", n.Name()),
Value: fmt.Sprintf("%d keys", n.size),
Component: fmt.Sprintf("storage/%s/size", n.Name()),
Value: fmt.Sprintf("%d octets", n.size),
Status: sdk.MonitoringStatusOK,
}}
}
Expand Down Expand Up @@ -299,6 +300,7 @@ func (n *Buffer) dirSize() (int64, error) {
defer dial.Close() // nolint
defer target.Close() //
n.pingStatus = sdk.MonitoringStatusOK

return n.computeDirSizeRecursive(target, ".")
}

Expand All @@ -309,7 +311,7 @@ func (n *Buffer) computeDirSizeRecursive(v *gonfs.Target, path string) (int64, e
return 0, err
}
for _, e := range entries {
if e.FileName == "." || e.FileName == ".." {
if strings.HasPrefix(e.FileName, ".") {
continue
}
if e.IsDir() {
Expand Down

0 comments on commit b4d99f6

Please sign in to comment.