ax(mining): rename minersMu to minersMutex in wsClient
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run

AX Principle 1: predictable names over short names. The abbreviated
field minersMu was missed when the EventHub mu was renamed to mutex
in a prior sweep.

Co-Authored-By: Charon <charon@lethean.io>
This commit is contained in:
Claude 2026-04-02 17:45:32 +01:00
parent d10faee13d
commit 9da561ae95
No known key found for this signature in database
GPG key ID: AF404715446AEB41

View file

@ -60,7 +60,7 @@ type wsClient struct {
send chan []byte
hub *EventHub
miners map[string]bool // subscribed miners, "*" for all
minersMu sync.RWMutex // protects miners map from concurrent access
minersMutex sync.RWMutex // protects miners map from concurrent access
closeOnce sync.Once
}
@ -208,8 +208,8 @@ func (h *EventHub) shouldSendToClient(client *wsClient, event Event) bool {
}
// Check miner subscription for miner events (protected by mutex)
client.minersMu.RLock()
defer client.minersMu.RUnlock()
client.minersMutex.RLock()
defer client.minersMutex.RUnlock()
if client.miners == nil || len(client.miners) == 0 {
// No subscription filter, send all
@ -359,12 +359,12 @@ func (c *wsClient) readPump() {
switch msg.Type {
case "subscribe":
// Update miner subscription (protected by mutex)
c.minersMu.Lock()
c.minersMutex.Lock()
c.miners = make(map[string]bool)
for _, m := range msg.Miners {
c.miners[m] = true
}
c.minersMu.Unlock()
c.minersMutex.Unlock()
logging.Debug("client subscribed to miners", logging.Fields{"miners": msg.Miners})
case "ping":