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-04-18 19:21:44 +0300
committerJeffB42 <10328858+JeffB42@users.noreply.github.com>2021-04-18 19:21:44 +0300
commitdfc72f314fcf636157760a6f55b31a466dfe0f4d (patch)
treebaa0c954057f64d6e3b31017b62278df714e1d14
parentec6eb1e6d42f116a0edb75e5b05eccffe47e994d (diff)
added EXPERIMENTAL_UPDATE_FREQUENCY
-rwxr-xr-xui/ui.go20
1 files changed, 19 insertions, 1 deletions
diff --git a/ui/ui.go b/ui/ui.go
index 61e2da5..e5e5aad 100755
--- a/ui/ui.go
+++ b/ui/ui.go
@@ -2,6 +2,8 @@ package ui
import (
"fmt"
+ "os"
+ "strconv"
"strings"
"sync"
"time"
@@ -100,7 +102,23 @@ func New(endpoint, key string, width, height int) *UI {
}
instance.splashPanel = NewSplashPanel(instance)
- instance.backgroundTask = utils.CreateBackgroundTask(time.Second * 20, 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_UPDATE_FREQUENCY")
+ if updateFrequency != "" {
+ logger.Infof("Ui.New() - EXPERIMENTAL_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()
logger.TraceLeave("ui.New()")