From c0856259cd89406818d30362c4d08a97403ff262 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 2 Apr 2026 07:49:17 +0100 Subject: [PATCH] ax(node): rename abbreviated mu/wg to resultsMutex/waitGroup in GetAllStats MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit AX Principle 1 — predictable names over short names. `mu` and `wg` require mental mapping; `resultsMutex` and `waitGroup` state their purpose directly. Co-Authored-By: Charon --- pkg/node/controller.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pkg/node/controller.go b/pkg/node/controller.go index 0660b07..e66ec62 100644 --- a/pkg/node/controller.go +++ b/pkg/node/controller.go @@ -242,13 +242,13 @@ func (c *Controller) GetRemoteLogs(peerID, minerName string, lines int) ([]strin func (c *Controller) GetAllStats() map[string]*StatsPayload { peers := c.peers.GetConnectedPeers() results := make(map[string]*StatsPayload) - var mu sync.Mutex - var wg sync.WaitGroup + var resultsMutex sync.Mutex + var waitGroup sync.WaitGroup for _, peer := range peers { - wg.Add(1) + waitGroup.Add(1) go func(p *Peer) { - defer wg.Done() + defer waitGroup.Done() stats, err := c.GetRemoteStats(p.ID) if err != nil { logging.Debug("failed to get stats from peer", logging.Fields{ @@ -258,13 +258,13 @@ func (c *Controller) GetAllStats() map[string]*StatsPayload { }) return // Skip failed peers } - mu.Lock() + resultsMutex.Lock() results[p.ID] = stats - mu.Unlock() + resultsMutex.Unlock() }(peer) } - wg.Wait() + waitGroup.Wait() return results }