mirror of
https://github.com/calibrain/shelfmark.git
synced 2026-11-16 04:28:16 +00:00
Fixes #1685 `_fetch_download_count_inline` fetches `/dyn/md5/inline_info/<md5>` for every search result (5 workers) through a module-level `requests.Session`, with no `proxies=`. `get_proxies()` reads the app config rather than the environment, so with the proxy set in Settings → Network the search page and the bypasser used it while these requests left from the host's own IP, about 50 per search. It now passes `network.get_proxies(url)` on each request, as the Libgen fast path in the same file already does. The session stays module-level for keep-alive, and proxies are resolved per request, so a settings change applies without a restart. Verification (macOS, `uv run --frozen pytest`): - New `tests/direct_download/test_download_count_proxy.py` passes. With the source change reverted it fails (`proxies` is `None`). - `tests/direct_download`: 135 passed, including `test_download_count_reuse.py`. - `ruff check` and `ruff format --check` on the changed files pass. - Not re-run live with this branch built. The behaviour before the change was observed on a running v1.6.2 container: 5 sockets from the `ThreadPoolExecutor` threads straight to the AA mirror's IP on :443, and 1 to the proxy. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **Bug Fixes** * Anna’s Archive download counts are now retrieved using the configured network proxies. This improves access to download-count information in environments where requests need a proxy, while preserving the existing response handling and timeout behavior. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>