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:
2025-07-27 23:38:38 +02:00
parent 76ec9f68b7
commit 1d05372899
4 changed files with 224 additions and 109 deletions
+11
View File
@@ -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