Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
fix: resolve race condition in mock mode update loop
rcourtmanf7c4e9cdde6e
diff --git a/internal/mock/integration.go b/internal/mock/integration.goindex 8205873637..5d3a42f09a 100644--- a/internal/mock/integration.go+++ b/internal/mock/integration.go@@ -20,6 +20,7 @@ var (enabled atomic.BoolupdateTicker *time.TickerstopUpdatesCh chan struct{}+ updateLoopWg sync.WaitGroup)const updateInterval = 2 * time.Second@@ -125,7 +126,9 @@ func startUpdateLoopLocked() {stopUpdatesCh = stopChupdateTicker = ticker+ updateLoopWg.Add(1)go func(stop <-chan struct{}, tick *time.Ticker) {+ defer updateLoopWg.Done()for {select {case <-tick.C:@@ -139,14 +142,16 @@ func startUpdateLoopLocked() {}func stopUpdateLoopLocked() {- if ticker := updateTicker; ticker != nil {- ticker.Stop()- updateTicker = nil- }if ch := stopUpdatesCh; ch != nil {close(ch)stopUpdatesCh = nil}+ if ticker := updateTicker; ticker != nil {+ ticker.Stop()+ updateTicker = nil+ }+ // Wait for the update goroutine to exit+ updateLoopWg.Wait()}func updateMetrics(cfg MockConfig) {