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 <charon@lethean.io>
This commit is contained in:
parent
5b7c84142e
commit
9280527f19
1 changed files with 4 additions and 4 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue