diff options
Diffstat (limited to 'ui/IdleStatusPanel.go')
-rwxr-xr-x | ui/IdleStatusPanel.go | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/ui/IdleStatusPanel.go b/ui/IdleStatusPanel.go index 0535e46..a2b3882 100755 --- a/ui/IdleStatusPanel.go +++ b/ui/IdleStatusPanel.go @@ -3,6 +3,8 @@ package ui import ( // "encoding/json" // "fmt" + "os" + "strconv" // "sync" "time" @@ -31,7 +33,23 @@ func IdleStatusPanel(ui *UI) *idleStatusPanel { instance := &idleStatusPanel{ CommonPanel: NewTopLevelCommonPanel("IdleStatusPanel", ui), } - instance.backgroundTask = utils.CreateBackgroundTask(time.Second * 2, instance.update) + + // Default timeout of 20 seconds. + durration := time.Second * 20 + + // Experimental, set the timeout based on config setting, but only if the config is pressent. + updateFrequency := os.Getenv("EXPERIMENTAL_IDLE_UPDATE_FREQUENCY") + if updateFrequency != "" { + logger.Infof("Ui.New() - EXPERIMENTAL_IDLE_UPDATE_FREQUENCY is present, frequency is %s", updateFrequency) + val, err := strconv.Atoi(updateFrequency) + if err == nil { + durration = time.Second * time.Duration(val) + } else { + logger.LogError("Ui.New()", "strconv.Atoi()", err) + } + } + + instance.backgroundTask = utils.CreateBackgroundTask(durration, instance.update) instance.initialize() idleStatusPanelInstance = instance |