fix v0 ci & bugs (#91)

* fix potenial race

* feat: add switch for nat and query

* update gopsutil & fix ci

---------

Co-authored-by: ChrisKim <[email protected]>
This commit is contained in:
UUBulb
2024-11-24 01:02:03 +08:00
committed by GitHub
co-authored by ChrisKim
parent 34faa8d63a
commit 293ef0b8b2
5 changed files with 61 additions and 66 deletions
+3 -3
View File
@@ -67,7 +67,7 @@ var statDataFetchAttempts = map[string]int{
}
var (
updateTempStatus = new(atomic.Int32)
updateTempStatus = new(atomic.Bool)
)
func InitConfig(cfg *model.AgentConfig) {
@@ -367,10 +367,10 @@ func updateGPUStat() float64 {
}
func updateTemperatureStat() {
if !updateTempStatus.CompareAndSwap(0, 1) {
if !updateTempStatus.CompareAndSwap(false, true) {
return
}
defer updateTempStatus.Store(0)
defer updateTempStatus.Store(false)
if statDataFetchAttempts["Temperatures"] < maxDeviceDataFetchAttempts {
temperatures, err := sensors.SensorsTemperatures()