Skip to content

Commit b4d99f6

Browse files
authored
fix(cdn): do not compute size from hidden directory (#5883)
* fix(cdn): do not compute size from hidden directory * fix: rename status
1 parent 6c07e41 commit b4d99f6

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

engine/cdn/storage/nfs/nfs.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"io"
77
"os"
88
"path/filepath"
9+
"strings"
910
"time"
1011

1112
"github.com/go-gorp/gorp"
@@ -185,8 +186,8 @@ func (n *Buffer) Status(_ context.Context) []sdk.MonitoringStatusLine {
185186
Status: n.pingStatus,
186187
},
187188
{
188-
Component: fmt.Sprintf("storage/%s/redis_dbsize", n.Name()),
189-
Value: fmt.Sprintf("%d keys", n.size),
189+
Component: fmt.Sprintf("storage/%s/size", n.Name()),
190+
Value: fmt.Sprintf("%d octets", n.size),
190191
Status: sdk.MonitoringStatusOK,
191192
}}
192193
}
@@ -299,6 +300,7 @@ func (n *Buffer) dirSize() (int64, error) {
299300
defer dial.Close() // nolint
300301
defer target.Close() //
301302
n.pingStatus = sdk.MonitoringStatusOK
303+
302304
return n.computeDirSizeRecursive(target, ".")
303305
}
304306

@@ -309,7 +311,7 @@ func (n *Buffer) computeDirSizeRecursive(v *gonfs.Target, path string) (int64, e
309311
return 0, err
310312
}
311313
for _, e := range entries {
312-
if e.FileName == "." || e.FileName == ".." {
314+
if strings.HasPrefix(e.FileName, ".") {
313315
continue
314316
}
315317
if e.IsDir() {

0 commit comments

Comments
 (0)