Skip to content

Commit 3e659ec

Browse files
Merge pull request #1766 from sjenning/adapt-long-du
adaptive longOp for du operation
2 parents b9ab5d6 + fd9c6d2 commit 3e659ec

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

container/common/fsHandler.go

+6-2
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
)
@@ -111,6 +110,7 @@ func (fh *realFsHandler) update() error {
111110

112111
func (fh *realFsHandler) trackUsage() {
113112
fh.update()
113+
longOp := time.Second
114114
for {
115115
select {
116116
case <-fh.stopChan:
@@ -128,7 +128,11 @@ func (fh *realFsHandler) trackUsage() {
128128
}
129129
duration := time.Since(start)
130130
if duration > longOp {
131-
glog.V(2).Infof("du and find on following dirs took %v: %v", duration, []string{fh.rootfs, fh.extraDir})
131+
// adapt longOp time so that message doesn't continue to print
132+
// if the long duration is persistent either because of slow
133+
// disk or lots of containers.
134+
longOp = longOp + time.Second
135+
glog.V(2).Infof("du and find on following dirs took %v: %v; will not log again for this container unless duration exceeds %d seconds.", duration, []string{fh.rootfs, fh.extraDir}, longOp)
132136
}
133137
}
134138
}

0 commit comments

Comments
 (0)