Merge pull request #1766 from sjenning/adapt-long-du
adaptive longOp for du operation
This commit is contained in:
commit
3e659ec0d1
@ -51,7 +51,6 @@ type realFsHandler struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
longOp = time.Second
|
|
||||||
timeout = 2 * time.Minute
|
timeout = 2 * time.Minute
|
||||||
maxBackoffFactor = 20
|
maxBackoffFactor = 20
|
||||||
)
|
)
|
||||||
@ -111,6 +110,7 @@ func (fh *realFsHandler) update() error {
|
|||||||
|
|
||||||
func (fh *realFsHandler) trackUsage() {
|
func (fh *realFsHandler) trackUsage() {
|
||||||
fh.update()
|
fh.update()
|
||||||
|
longOp := time.Second
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-fh.stopChan:
|
case <-fh.stopChan:
|
||||||
@ -128,7 +128,11 @@ func (fh *realFsHandler) trackUsage() {
|
|||||||
}
|
}
|
||||||
duration := time.Since(start)
|
duration := time.Since(start)
|
||||||
if duration > longOp {
|
if duration > longOp {
|
||||||
glog.V(2).Infof("du and find on following dirs took %v: %v", duration, []string{fh.rootfs, fh.extraDir})
|
// adapt longOp time so that message doesn't continue to print
|
||||||
|
// if the long duration is persistent either because of slow
|
||||||
|
// disk or lots of containers.
|
||||||
|
longOp = longOp + time.Second
|
||||||
|
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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user