Use tickers instead of for loops with sleep, replace interface{} with any

This commit is contained in:
eleksir
2025-03-28 02:34:32 +03:00
parent 40eaac419d
commit b8b9ba2c2c
9 changed files with 31 additions and 33 deletions

View File

@@ -9,7 +9,9 @@ import (
// UpdateLaStats вытаскивает показание LA за последнюю минуту.
func (c *MyConfig) UpdateLaStats() {
for {
ticker := time.NewTicker(time.Second * 3)
for range ticker.C {
l, _ := load.Avg()
lav := fmt.Sprintf("%.2f", l.Load1)
@@ -18,7 +20,5 @@ func (c *MyConfig) UpdateLaStats() {
c.Values.La = lav
c.Channels.UpdateReady <- true
}
time.Sleep(3 * time.Second)
}
}