Adjust period after each fh.update() call
Signed-off-by: Ted Yu <yuzhihong@gmail.com>
This commit is contained in:
parent
9268b49cf4
commit
78af2b02e1
@ -106,13 +106,8 @@ func (fh *realFsHandler) update() error {
|
||||
}
|
||||
|
||||
func (fh *realFsHandler) trackUsage() {
|
||||
fh.update()
|
||||
longOp := time.Second
|
||||
for {
|
||||
select {
|
||||
case <-fh.stopChan:
|
||||
return
|
||||
case <-time.After(fh.period):
|
||||
start := time.Now()
|
||||
if err := fh.update(); err != nil {
|
||||
klog.Errorf("failed to collect filesystem stats - %v", err)
|
||||
@ -131,6 +126,10 @@ func (fh *realFsHandler) trackUsage() {
|
||||
longOp = longOp + time.Second
|
||||
klog.V(2).Infof("fs: disk usage and inodes count on following dirs took %v: %v; will not log again for this container unless duration exceeds %v", duration, []string{fh.rootfs, fh.extraDir}, longOp)
|
||||
}
|
||||
select {
|
||||
case <-fh.stopChan:
|
||||
return
|
||||
case <-time.After(fh.period):
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user