fix(site-finder): optimize zone-regulation resolve in /analyze (#1850) #1901

Merged
bot-backend merged 1 commit from fix/analyze-zone-resolve-perf into main 2026-06-25 09:12:42 +00:00

1 commit

Author SHA1 Message Date
18942898d1 fix(site-finder): memoize zone_index WFS lookup + dedupe resolve in /analyze (#1850)
All checks were successful
CI / backend-tests (pull_request) Successful in 11m8s
CI / changes (pull_request) Successful in 7s
CI / frontend-tests (pull_request) Has been skipped
CI / openapi-codegen-check (pull_request) Successful in 1m46s
- memoize coord→zone_index (bounded thread-safe LRU, ±1m key, negative caching) so
  repeat /analyze skips the live WFS round-trip; regulation content still read fresh
  from zone_regulation_cache (cache-update correctness preserved). Lock guards the
  module-global memo (sync /analyze runs in threadpool); WFS call stays outside lock.
- resolve once, thread into build_ird_analyze_block (resolved_zone_regulation kwarg)
  → no redundant 2nd resolve when both enable_zoning_regulation_in_analyze and
  enable_ird_analyze are on.
- unify divergent timeouts (parcels 3s / ird 4s) into settings.geoportal_timeout_s=4.
- document (not change) the mid-request db.commit() smell on cache-miss (separate task).

Closes #1850
2026-06-25 14:00:13 +05:00