Fix linting errors for magic numbers in handler queue sizes
- Define constants for all handler queue capacities - Fix integer overflow warning in metrics calculation - Add missing blank lines before continue statements
This commit is contained in:
@@ -8,6 +8,11 @@ import (
|
||||
"git.eeqj.de/sneak/routewatch/internal/ristypes"
|
||||
)
|
||||
|
||||
const (
|
||||
// peerHandlerQueueSize is the queue capacity for peer tracking operations
|
||||
peerHandlerQueueSize = 500
|
||||
)
|
||||
|
||||
// PeerHandler tracks BGP peers from all message types
|
||||
type PeerHandler struct {
|
||||
db database.Store
|
||||
@@ -27,6 +32,12 @@ func (h *PeerHandler) WantsMessage(_ string) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// QueueCapacity returns the desired queue capacity for this handler
|
||||
func (h *PeerHandler) QueueCapacity() int {
|
||||
// Peer tracking is lightweight but involves database ops, use moderate queue
|
||||
return peerHandlerQueueSize
|
||||
}
|
||||
|
||||
// HandleMessage processes a message to track peer information
|
||||
func (h *PeerHandler) HandleMessage(msg *ristypes.RISMessage) {
|
||||
// Parse peer ASN from string
|
||||
|
||||
Reference in New Issue
Block a user