parent
c784010593
commit
8858facc91
|
@ -9,7 +9,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
influxLogger = logger.NewLogger("consumer")
|
influxLogger = logger.NewLogger("influx")
|
||||||
)
|
)
|
||||||
|
|
||||||
type influxMetric struct {
|
type influxMetric struct {
|
||||||
|
|
8
main.go
8
main.go
|
@ -120,9 +120,6 @@ func main() {
|
||||||
tempetureChannel = make(chan processor.TempetureInfo)
|
tempetureChannel = make(chan processor.TempetureInfo)
|
||||||
fanspeedChannel = make(chan processor.FanspeedInfo)
|
fanspeedChannel = make(chan processor.FanspeedInfo)
|
||||||
)
|
)
|
||||||
defer close(tempetureChannel)
|
|
||||||
defer close(fanspeedChannel)
|
|
||||||
|
|
||||||
processors = make([]processor.Processor, 0, processorCount)
|
processors = make([]processor.Processor, 0, processorCount)
|
||||||
for i := 0; i < processorCount; i++ {
|
for i := 0; i < processorCount; i++ {
|
||||||
if info, err := processor.NewProcessorInfo(handler, i, sampleDuration,
|
if info, err := processor.NewProcessorInfo(handler, i, sampleDuration,
|
||||||
|
@ -141,10 +138,15 @@ func main() {
|
||||||
fanController := consumer.NewFanControl(processorCount, sampleDuration, handler)
|
fanController := consumer.NewFanControl(processorCount, sampleDuration, handler)
|
||||||
metricLogger := consumer.NewInfluxMetric("", processorCount, handler)
|
metricLogger := consumer.NewInfluxMetric("", processorCount, handler)
|
||||||
|
|
||||||
|
|
||||||
handler.IncreaseWait()
|
handler.IncreaseWait()
|
||||||
go FanoutTempeture(tempetureChannel, handler, metricLogger.TempetureConsumer())
|
go FanoutTempeture(tempetureChannel, handler, metricLogger.TempetureConsumer())
|
||||||
|
defer close(tempetureChannel)
|
||||||
|
|
||||||
handler.IncreaseWait()
|
handler.IncreaseWait()
|
||||||
go FanoutSpeed(fanspeedChannel, handler, fanController.Consumer(), metricLogger.FanSpeedConsumer())
|
go FanoutSpeed(fanspeedChannel, handler, fanController.Consumer(), metricLogger.FanSpeedConsumer())
|
||||||
|
defer close(fanspeedChannel)
|
||||||
|
|
||||||
handler.IncreaseWait()
|
handler.IncreaseWait()
|
||||||
go fanController.StartControl()
|
go fanController.StartControl()
|
||||||
handler.IncreaseWait()
|
handler.IncreaseWait()
|
||||||
|
|
Loading…
Reference in New Issue