write goroutine 제거
This commit is contained in:
parent
17dcbac9ce
commit
8c1dcace29
|
@ -16,6 +16,7 @@ import (
|
||||||
func init() {
|
func init() {
|
||||||
influxmodels.EnableUintSupport()
|
influxmodels.EnableUintSupport()
|
||||||
}
|
}
|
||||||
|
|
||||||
type processorData struct {
|
type processorData struct {
|
||||||
Tempeture float64
|
Tempeture float64
|
||||||
FanSpeed int
|
FanSpeed int
|
||||||
|
@ -113,7 +114,7 @@ func (m *influxMetric) StartLogging() {
|
||||||
case <-ticker:
|
case <-ticker:
|
||||||
swapped := (*producer.OSMetricInfo)(atomic.SwapPointer(&osMetricPtr, nil))
|
swapped := (*producer.OSMetricInfo)(atomic.SwapPointer(&osMetricPtr, nil))
|
||||||
copy(sendData, metricData)
|
copy(sendData, metricData)
|
||||||
go m.sendPoint(influxDbConn, sendData, swapped)
|
m.sendPoint(influxDbConn, sendData, swapped)
|
||||||
case <-m.handler.Done():
|
case <-m.handler.Done():
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -138,6 +139,8 @@ func (m *influxMetric) sendPoint(
|
||||||
Database: "core",
|
Database: "core",
|
||||||
Precision: "s",
|
Precision: "s",
|
||||||
})
|
})
|
||||||
|
batchPoint.SetWriteConsistency("consistency all")
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
m.logger.Warn(err)
|
m.logger.Warn(err)
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue