diff --git a/consumer/influx_stat.go b/consumer/influx_stat.go index 131622c..5d0bc5f 100644 --- a/consumer/influx_stat.go +++ b/consumer/influx_stat.go @@ -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: diff --git a/main.go b/main.go index 2d395e7..566820b 100644 --- a/main.go +++ b/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 } diff --git a/processor/processor.go b/processor/processor.go index 2116db0..213597d 100644 --- a/processor/processor.go +++ b/processor/processor.go @@ -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