From 9280527f19297354326edeeefb27c81c159daa67 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 2 Apr 2026 14:16:07 +0100 Subject: [PATCH] ax(node): rename stopChan to stopChannel in PeerRegistry 'Chan' is an abbreviation; AX Principle 1 requires predictable names over short names. stopChannel is unambiguous without a comment. Co-Authored-By: Charon --- pkg/node/peer.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/node/peer.go b/pkg/node/peer.go index 21d17e1..8385f20 100644 --- a/pkg/node/peer.go +++ b/pkg/node/peer.go @@ -109,8 +109,8 @@ type PeerRegistry struct { dirty bool // Whether there are unsaved changes saveTimer *time.Timer // Timer for debounced save saveMutex sync.Mutex // Protects dirty and saveTimer - stopChan chan struct{} // Signal to stop background save - saveStopOnce sync.Once // Ensure stopChan is closed only once + stopChannel chan struct{} // Signal to stop background save + saveStopOnce sync.Once // Ensure stopChannel is closed only once } // Dimension weights for peer selection. @@ -139,7 +139,7 @@ func NewPeerRegistryWithPath(peersPath string) (*PeerRegistry, error) { registry := &PeerRegistry{ peers: make(map[string]*Peer), peersFilePath: peersPath, - stopChan: make(chan struct{}), + stopChannel: make(chan struct{}), authMode: PeerAuthOpen, // Default to open for backward compatibility allowedPublicKeys: make(map[string]bool), } @@ -662,7 +662,7 @@ func (registry *PeerRegistry) saveNow() error { // defer registry.Close() // flush pending writes on shutdown func (registry *PeerRegistry) Close() error { registry.saveStopOnce.Do(func() { - close(registry.stopChan) + close(registry.stopChannel) }) // Cancel pending timer and save immediately if dirty