Websocket fixes (#461)

* Bump api spec version

* Do not panic on cpu monitoring error

* Centralize the socket disconnect logic and fire it also when socket errors occur. Hopefully closes #421
This commit is contained in:
Gabe Kangas
2020-12-21 19:42:47 -08:00
committed by GitHub
parent eab45c7e92
commit e558c549d7
4 changed files with 41 additions and 15 deletions

View File

@@ -6,6 +6,8 @@ import (
"github.com/shirou/gopsutil/cpu"
"github.com/shirou/gopsutil/disk"
"github.com/shirou/gopsutil/mem"
log "github.com/sirupsen/logrus"
)
// Max number of metrics we want to keep.
@@ -18,7 +20,8 @@ func collectCPUUtilization() {
v, err := cpu.Percent(0, false)
if err != nil {
panic(err)
log.Errorln(err)
return
}
metricValue := timestampedValue{time.Now(), int(v[0])}