Guard geo_service.init_geoip against repeated initialization

This commit is contained in:
2026-04-18 19:54:05 +02:00
parent 99731a9919
commit 52e08e17a4
3 changed files with 40 additions and 1 deletions

View File

@@ -66,6 +66,8 @@ Reference: `Docs/Refactoring.md` for full analysis of each issue.
### 4. Add Path Validation to `_geoip_reader` Initialization
**Status:** Completed.
**Where:** `backend/app/services/geo_service.py` — the `init_geoip()` function (around line 249) sets the module-level `_geoip_reader` without acquiring `_cache_lock`.
**Goal:** Add a clear code comment documenting the startup-only assumption: `init_geoip()` must only be called during application startup (from `startup.py`) before request handling begins. Optionally, add an assertion or guard that prevents double-initialization.