ax(mining): rename minersMu to minersMutex in wsClient
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:
parent
d10faee13d
commit
9da561ae95
1 changed files with 5 additions and 5 deletions
|
|
@ -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":
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue