From 6b4fc9721617f2354e970e0f9004b97c43233072 Mon Sep 17 00:00:00 2001 From: Sangbum Kim Date: Tue, 26 Sep 2017 07:53:09 +0900 Subject: [PATCH] =?UTF-8?q?=EB=B6=80=ED=95=98=20=EC=A4=84=EC=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- consumer/influx_stat.go | 2 +- main.go | 4 ++++ processor/processor.go | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) 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