Clean up and optimize codebase for production readiness
Performance & Reliability Improvements: - Increase WebSocket buffer sizes from 1KB to 8KB for better throughput - Increase broadcast channel buffer from 100 to 1000 messages - Increase Beast message channel buffer from 1000 to 5000 messages - Increase connection timeout from 10s to 30s for remote receivers Code Quality Improvements: - Remove debug output from production code (CPR Debug, Merger Update spam) - Add MaxDistance constant to replace magic number (999999) - Clean up comments for better maintainability - Implement auto-enable for selected aircraft trails Benefits: - Much cleaner server logs without debug spam - Better performance under high aircraft density - More reliable WebSocket connections with larger buffers - Improved fault tolerance with increased timeouts 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
9389cb8823
commit
064ba2de71
5 changed files with 23 additions and 23 deletions
|
|
@ -30,6 +30,11 @@ import (
|
|||
"skyview/internal/modes"
|
||||
)
|
||||
|
||||
const (
|
||||
// MaxDistance represents an infinite distance for initialization
|
||||
MaxDistance = float64(999999)
|
||||
)
|
||||
|
||||
// Source represents a data source (dump1090 receiver or similar ADS-B source).
|
||||
// It contains both static configuration and dynamic status information used
|
||||
// for data fusion decisions and source monitoring.
|
||||
|
|
@ -431,14 +436,9 @@ func (m *Merger) mergeAircraftData(state *AircraftState, new *modes.Aircraft, so
|
|||
}
|
||||
|
||||
if updatePosition {
|
||||
fmt.Printf("Merger Update %06X: %.6f,%.6f -> %.6f,%.6f\n",
|
||||
state.Aircraft.ICAO24, state.Latitude, state.Longitude, new.Latitude, new.Longitude)
|
||||
state.Latitude = new.Latitude
|
||||
state.Longitude = new.Longitude
|
||||
state.PositionSource = sourceID
|
||||
} else {
|
||||
fmt.Printf("Merger Skip %06X: rejected update %.6f,%.6f (current: %.6f,%.6f)\n",
|
||||
state.Aircraft.ICAO24, new.Latitude, new.Longitude, state.Latitude, state.Longitude)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -672,7 +672,7 @@ func (m *Merger) GetAircraft() map[uint32]*AircraftState {
|
|||
stateCopy.Age = now.Sub(state.LastUpdate).Seconds()
|
||||
|
||||
// Find closest receiver distance
|
||||
minDistance := float64(999999)
|
||||
minDistance := MaxDistance
|
||||
for _, srcData := range state.Sources {
|
||||
if srcData.Distance > 0 && srcData.Distance < minDistance {
|
||||
minDistance = srcData.Distance
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue