Skip to content

FIX: IP lookup logging autoload#161

Open
merefield wants to merge 3 commits intomainfrom
fix_ip_lookup_logging_autoload
Open

FIX: IP lookup logging autoload#161
merefield wants to merge 3 commits intomainfrom
fix_ip_lookup_logging_autoload

Conversation

@merefield
Copy link
Owner

@merefield merefield commented Mar 7, 2026

Summary

This fixes the IP lookup logging helper so Sidekiq jobs and related lookup classes can resolve it reliably under Zeitwerk autoloading.

The previous implementation added ip_lookup_log by reopening Locations directly, which is not a stable autoload target. In some runtime paths,
especially background jobs, that method could be missing and IP lookup would fail when logging was invoked.

Changes

  • move IP lookup logging behind an autoloadable constant: Locations::LoggingHelper.ip_lookup_log
  • update all IP lookup / GeoNames call sites to use Locations::LoggingHelper
  • add spec coverage for logging enabled and disabled behavior

Files Changed

  • app/jobs/regular/locations/ip_location_lookup.rb
  • lib/locations/geo_location_builder.rb
  • lib/locations/geo_names_client.rb
  • lib/locations/geo_names_granularity_picker.rb
  • lib/locations/logging_helper.rb
  • spec/lib/locations/logging_helper_spec.rb

Verification

  • bin/rspec plugins/discourse-locations/spec/lib/locations/logging_helper_spec.rb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant