부하 줄임
This commit is contained in:
parent
aab5631ca7
commit
6b4fc97216
|
@ -93,7 +93,7 @@ func (m *influxMetric) StartLogging() {
|
|||
case <-ticker:
|
||||
sendData := make([]data, m.processorCount)
|
||||
copy(sendData, metricData)
|
||||
go m.sendPoint(influxDbConn, batchPoint, sendData)
|
||||
m.sendPoint(influxDbConn, batchPoint, sendData)
|
||||
case changedSpeed := <-m.fanSpeedConsumer:
|
||||
metricData[changedSpeed.Id].FanSpeed = changedSpeed.FanSpeed
|
||||
case changedTempeture := <-m.tempetureConsumer:
|
||||
|
|
4
main.go
4
main.go
|
@ -73,6 +73,8 @@ func FanoutSpeed(sender <-chan processor.FanspeedInfo, handler util.Handler, rec
|
|||
log.Warn("Some Fanspeed consumer blocked!")
|
||||
}
|
||||
}
|
||||
runtime.Gosched()
|
||||
|
||||
case <-handler.Done():
|
||||
return
|
||||
}
|
||||
|
@ -96,6 +98,8 @@ func FanoutTempeture(sender <-chan processor.TempetureInfo, handler util.Handler
|
|||
log.Warn("Some Tempeture consumer blocked!")
|
||||
}
|
||||
}
|
||||
runtime.Gosched()
|
||||
|
||||
case <-handler.Done():
|
||||
return
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ import (
|
|||
"strings"
|
||||
"amuz.es/src/infra/cpu_ctrl/pid"
|
||||
"amuz.es/src/infra/cpu_ctrl/util"
|
||||
"runtime"
|
||||
)
|
||||
|
||||
type processor struct {
|
||||
|
@ -150,6 +151,7 @@ func (p *processor) StartMonitoring() {
|
|||
At: now,
|
||||
}:
|
||||
default:
|
||||
runtime.Gosched()
|
||||
}
|
||||
}
|
||||
p.tempeture = highestTemp
|
||||
|
@ -167,6 +169,7 @@ func (p *processor) StartMonitoring() {
|
|||
At: now,
|
||||
}:
|
||||
default:
|
||||
runtime.Gosched()
|
||||
}
|
||||
}
|
||||
p.fanSpeed = fanspeed
|
||||
|
|
Loading…
Reference in New Issue