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:
@@ -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])}
|
||||
|
||||
Reference in New Issue
Block a user