Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a factory service that can create GeoIp2\Database\Reader instances at runtime #60

Merged

Conversation

acelaya
Copy link
Member

@acelaya acelaya commented Mar 9, 2024

Closes #59

Part of shlinkio/shlink#2021

This PR stops using and registering GeoIp2\Database\Reader as a singleton service, and instead provides a new factory service which creates Reader instances at runtime.

This is needed because GeoIp2\Database\Reader instances are stateful, and they hold a reference to the metadata of the first file they were created with.

The new service will ensure every time an interaction with the GeoLite2 file is needed, it will be done with an up-to-date copy.

@acelaya acelaya force-pushed the feature/geolite-reader-factory branch from 8da0570 to b085cc5 Compare March 9, 2024 08:17
Copy link

codecov bot commented Mar 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.92%. Comparing base (0035a72) to head (b085cc5).
Report is 2 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main      #60      +/-   ##
============================================
+ Coverage     98.87%   98.92%   +0.04%     
- Complexity       33       35       +2     
============================================
  Files            10       11       +1     
  Lines            89       93       +4     
============================================
+ Hits             88       92       +4     
  Misses            1        1              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@acelaya acelaya merged commit 074a627 into shlinkio:main Mar 9, 2024
8 checks passed
@acelaya acelaya deleted the feature/geolite-reader-factory branch March 9, 2024 08:20
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.

Provide a GeoLite2ReaderFactory service
1 participant