aprs.me/warning_fixes_summary.md
2025-07-14 17:06:39 -05:00

2.8 KiB

Warning Fixes Summary

Issue

Running mix compile --warnings-as-errors was failing due to 23 unused function warnings in the packet consumer module.

Root Cause

During the INSERT performance optimization, we implemented a new fast packet processing pipeline but left the old implementation functions in place, causing unused function warnings.

Functions Removed

Old Packet Processing Functions (Unused after optimization):

  • prepare_packet_for_insert/1 - Old slow packet preparation
  • normalize_packet_attrs/1 - Complex normalization logic
  • set_received_at/1 - Timestamp setting
  • patch_lat_lon_from_data_extended/1 - Position extraction from extended data
  • extract_position/1 - Position extraction logic
  • extract_position_from_data_extended/1 - Extended data position parsing
  • extract_position_from_data_extended_case/1 - Case-based position extraction
  • has_standard_position?/1 - Position validation
  • extract_standard_position/1 - Standard position extraction
  • extract_lat_from_ext_map/1 - Latitude extraction
  • extract_lon_from_ext_map/1 - Longitude extraction
  • set_lat_lon/3 - Coordinate setting and rounding
  • normalize_ssid/1 - SSID normalization
  • create_location_geometry/1 - Old geometry creation
  • valid_coordinates?/2 - Coordinate validation
  • normalize_coordinate/1 - Coordinate normalization
  • create_point/2 - Point geometry creation
  • valid_packet?/1 - Packet validation
  • sanitize_packet_strings/1 - String sanitization
  • to_float/1 - Float conversion
  • normalize_data_type/1 - Data type normalization
  • struct_to_map/1 - Struct conversion
  • truncate_datetimes_to_second/1 - DateTime truncation
  • normalize_numeric_types/1 - Numeric type conversion

Functions Kept:

  • validate_essential_fields/2 - Used by the new fast pipeline
  • prepare_packet_for_insert_fast/2 - New optimized packet preparation
  • extract_essential_fields/1 - Essential field extraction
  • create_location_geometry_fast/1 - Fast geometry creation
  • All new fast helper functions

Result

  • All 23 unused function warnings eliminated
  • mix compile --warnings-as-errors now passes
  • All 351 tests still passing
  • Code properly formatted
  • No functional impact - the new fast pipeline remains intact

Performance Impact

The cleanup removed ~250 lines of unused legacy code, which:

  • Reduces module size and compilation time
  • Eliminates confusion about which functions are actually used
  • Makes the codebase cleaner and more maintainable
  • Ensures only the optimized fast packet processing pipeline is used

File Modified

  • /Users/graham/dev/aprs.me/lib/aprsme/packet_consumer.ex - Removed 23 unused functions

The module now only contains the optimized INSERT performance code, making it much cleaner and easier to maintain.