2.8 KiB
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 preparationnormalize_packet_attrs/1- Complex normalization logicset_received_at/1- Timestamp settingpatch_lat_lon_from_data_extended/1- Position extraction from extended dataextract_position/1- Position extraction logicextract_position_from_data_extended/1- Extended data position parsingextract_position_from_data_extended_case/1- Case-based position extractionhas_standard_position?/1- Position validationextract_standard_position/1- Standard position extractionextract_lat_from_ext_map/1- Latitude extractionextract_lon_from_ext_map/1- Longitude extractionset_lat_lon/3- Coordinate setting and roundingnormalize_ssid/1- SSID normalizationcreate_location_geometry/1- Old geometry creationvalid_coordinates?/2- Coordinate validationnormalize_coordinate/1- Coordinate normalizationcreate_point/2- Point geometry creationvalid_packet?/1- Packet validationsanitize_packet_strings/1- String sanitizationto_float/1- Float conversionnormalize_data_type/1- Data type normalizationstruct_to_map/1- Struct conversiontruncate_datetimes_to_second/1- DateTime truncationnormalize_numeric_types/1- Numeric type conversion
Functions Kept:
validate_essential_fields/2- Used by the new fast pipelineprepare_packet_for_insert_fast/2- New optimized packet preparationextract_essential_fields/1- Essential field extractioncreate_location_geometry_fast/1- Fast geometry creation- All new fast helper functions
Result
- ✅ All 23 unused function warnings eliminated
- ✅
mix compile --warnings-as-errorsnow 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.