|
All checks were successful
CI / frontend-tests (pull_request) Has been skipped
CI / changes (push) Successful in 7s
CI / frontend-tests (push) Has been skipped
CI / changes (pull_request) Successful in 6s
CI / backend-tests (push) Successful in 6m28s
CI / backend-tests (pull_request) Successful in 6m26s
Deploy / build-frontend (push) Has been skipped
Deploy / changes (push) Successful in 6s
Deploy / build-backend (push) Successful in 1m41s
Deploy / build-worker (push) Successful in 4m51s
Deploy / deploy (push) Successful in 1m24s
Два внешних HTTP-вызова в analyze (_fetch_weather_sync + _fetch_seasonal_weather_sync) сидели без кэша. На проде в private network с restricted egress DNS до *.open-meteo.com фейлит и каждый replay висит полный timeout (5s + 15s = до 20с лишних на analyze). Профиль cProfile одного replay: 2.38с в httpx + 1.73с в SSL recv. Вынес логику в app/services/weather_cache.py: - TTL hit: forecast 6h, climate normals 7d. Negative-cache: 5min (DNS-fail не повторяет timeout на каждый analyze, восстановление подхватывается через ~5 минут). - Ключ — округлённые до 0.01° (~1 км) координаты. - Single-flight: per-cache threading.Lock + check-then-fetch-then-store. - Тайм-ауты сокращены: forecast 5s→2s, climate 15s→3s. Контракт для caller'а не изменился: None по-прежнему допустим (env_ok-флаг в _build_environmental_score). 7 файлов API-тестов обновили patch-цели на новые имена get_weather_cached / get_seasonal_weather_cached. 11 новых юнит-тестов в tests/services/test_weather_cache.py (single-flight через threading.Barrier(16), TTL expire через monkeypatch _now, изоляция forecast vs climate). Refs #1130 |
||
|---|---|---|
| .. | ||
| alembic | ||
| app | ||
| db/init | ||
| output | ||
| scripts | ||
| tests | ||
| .dockerignore | ||
| .env.example | ||
| .env.runtime.example | ||
| alembic.ini | ||
| debug.log | ||
| Dockerfile | ||
| pyproject.toml | ||
| uv.lock | ||