Skip to content

Commit 694214f

Browse files
committed
adaptive longOp for du operation
1 parent b9ab5d6 commit 694214f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

container/common/fsHandler.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ type realFsHandler struct {
5151
}
5252

5353
const (
54-
longOp = time.Second
5554
timeout = 2 * time.Minute
5655
maxBackoffFactor = 20
5756
)
@@ -60,6 +59,8 @@ const DefaultPeriod = time.Minute
6059

6160
var _ FsHandler = &realFsHandler{}
6261

62+
var longOp = time.Second
63+
6364
func NewFsHandler(period time.Duration, rootfs, extraDir string, fsInfo fs.FsInfo) FsHandler {
6465
return &realFsHandler{
6566
lastUpdate: time.Time{},
@@ -129,6 +130,10 @@ func (fh *realFsHandler) trackUsage() {
129130
duration := time.Since(start)
130131
if duration > longOp {
131132
glog.V(2).Infof("du and find on following dirs took %v: %v", duration, []string{fh.rootfs, fh.extraDir})
133+
// adapt longOp time so that message doesn't continue to print
134+
// if the long duration is persistent either because of slow
135+
// disk or lots of containers.
136+
longOp = longOp + time.Millisecond*100
132137
}
133138
}
134139
}

0 commit comments

Comments
 (0)