ax(mining): rename msg to clientMessage in wsClient.readPump
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. `msg` required
reading the struct to understand what it contained; `clientMessage`
is self-describing at the call site.

Co-Authored-By: Charon <charon@lethean.io>
This commit is contained in:
Claude 2026-04-02 17:55:41 +01:00
parent aba728ff83
commit 9096452ff1
No known key found for this signature in database
GPG key ID: AF404715446AEB41

View file

@ -348,24 +348,24 @@ func (client *wsClient) readPump() {
}
// Parse client message
var msg struct {
var clientMessage struct {
Type string `json:"type"`
Miners []string `json:"miners,omitempty"`
}
if err := UnmarshalJSON(message, &msg); err != nil {
if err := UnmarshalJSON(message, &clientMessage); err != nil {
continue
}
switch msg.Type {
switch clientMessage.Type {
case "subscribe":
// Update miner subscription (protected by mutex)
client.minersMutex.Lock()
client.miners = make(map[string]bool)
for _, m := range msg.Miners {
for _, m := range clientMessage.Miners {
client.miners[m] = true
}
client.minersMutex.Unlock()
logging.Debug("client subscribed to miners", logging.Fields{"miners": msg.Miners})
logging.Debug("client subscribed to miners", logging.Fields{"miners": clientMessage.Miners})
case "ping":
// Respond with pong