Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Z-Bolt/OctoScreen.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeffB42 <10328858+JeffB42@users.noreply.github.com>2021-08-07 20:07:05 +0300
committerJeffB42 <10328858+JeffB42@users.noreply.github.com>2021-08-07 20:07:05 +0300
commit0494207c80e1e51fd39221bfb063a95882edcb12 (patch)
tree41db4dabb82b8db8eec0a9bea02f6b184205cc44
parent8dc06fcb61cbf0065dcbad08c2d7d51476987861 (diff)
added additional experimental (and not published) config settings to set background task frequencies
-rwxr-xr-xui/IdleStatusPanel.go18
-rwxr-xr-xui/NetworkPanel.go18
-rwxr-xr-xui/PrintStatusPanel.go17
-rwxr-xr-xui/ui.go8
4 files changed, 54 insertions, 7 deletions
diff --git a/ui/IdleStatusPanel.go b/ui/IdleStatusPanel.go
index 0535e46..e01edcb 100755
--- a/ui/IdleStatusPanel.go
+++ b/ui/IdleStatusPanel.go
@@ -31,7 +31,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
diff --git a/ui/NetworkPanel.go b/ui/NetworkPanel.go
index 1feab9a..bd559f1 100755
--- a/ui/NetworkPanel.go
+++ b/ui/NetworkPanel.go
@@ -33,7 +33,23 @@ func NetworkPanel(
CommonPanel: NewCommonPanel("NetworkPanel", ui),
}
instance.initialize()
- instance.backgroundTask = utils.CreateBackgroundTask(time.Second * 3, instance.update)
+
+ // Default timeout of 30 seconds.
+ durration := time.Second * 30
+
+ // Experimental, set the timeout based on config setting, but only if the config is pressent.
+ updateFrequency := os.Getenv("EXPERIMENTAL_NETWORK_UPDATE_FREQUENCY")
+ if updateFrequency != "" {
+ logger.Infof("Ui.New() - EXPERIMENTAL_NETWORK_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)
networkPanelInstance = instance
}
diff --git a/ui/PrintStatusPanel.go b/ui/PrintStatusPanel.go
index cb39cc3..cd40e3e 100755
--- a/ui/PrintStatusPanel.go
+++ b/ui/PrintStatusPanel.go
@@ -43,9 +43,24 @@ func PrintStatusPanel(ui *UI) *printStatusPanel {
CommonPanel: NewTopLevelCommonPanel("PrintStatusPanel", ui),
}
+ // 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_PRINT_UPDATE_FREQUENCY")
+ if updateFrequency != "" {
+ logger.Infof("Ui.New() - EXPERIMENTAL_PRINT_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)
+ }
+ }
+
// TODO: revisit... some set the background task and then initialize
// and others initialize and then set the background task
- instance.backgroundTask = utils.CreateBackgroundTask(time.Second * 2, instance.update)
+ instance.backgroundTask = utils.CreateBackgroundTask(durration, instance.update)
instance.initialize()
printStatusPanelInstance = instance
}
diff --git a/ui/ui.go b/ui/ui.go
index e5e5aad..781df20 100755
--- a/ui/ui.go
+++ b/ui/ui.go
@@ -107,10 +107,10 @@ func New(endpoint, key string, width, height int) *UI {
durration := time.Second * 20
// Experimental, set the timeout based on config setting, but only if the config is pressent.
- updateFrequency := os.Getenv("EXPERIMENTAL_UPDATE_FREQUENCY")
- if updateFrequency != "" {
- logger.Infof("Ui.New() - EXPERIMENTAL_UPDATE_FREQUENCY is present, frequency is %s", updateFrequency)
- val, err := strconv.Atoi(updateFrequency)
+ uiUpdateFrequency := os.Getenv("EXPERIMENTAL_UI_UPDATE_FREQUENCY")
+ if uiUpdateFrequency != "" {
+ logger.Infof("Ui.New() - EXPERIMENTAL_UI_UPDATE_FREQUENCY is present, frequency is %s", uiUpdateFrequency)
+ val, err := strconv.Atoi(uiUpdateFrequency)
if err == nil {
durration = time.Second * time.Duration(val)
} else {