Log error in la.go if unable to open file

This commit is contained in:
eleksir
2026-03-31 00:55:38 +03:00
parent 0d3f805a2d
commit 3f1adbe126

View File

@@ -2,6 +2,7 @@ package lib
import ( import (
"fmt" "fmt"
"log"
"time" "time"
"github.com/shirou/gopsutil/load" "github.com/shirou/gopsutil/load"
@@ -22,7 +23,13 @@ func (c *MyConfig) UpdateLaStats() {
ticker.Reset(Delay) ticker.Reset(Delay)
} }
l, _ := load.Avg() l, err := load.Avg()
if err != nil {
log.Printf("Unable to get LA stats: %s", err)
continue
}
lav := fmt.Sprintf("%.2f", l.Load1) lav := fmt.Sprintf("%.2f", l.Load1)