mirror of
https://github.com/kuhyx/utils.git
synced 2026-11-14 18:30:58 +01:00
Every request went through the module-level requests.get/put/post/delete helpers, so each one paid a fresh DNS+TCP+TLS handshake. Measured today against the real backends that is 95ms/req to api.github.com and 52ms to Realtime Database -- on a 27-request diet-guard tick, most of the wall clock. Each transport module now binds a pooling requests.Session to the name `requests`. A Session is a drop-in for those helpers, so all 9 call sites and all 16 tests that patch `<module>.requests.<verb>` are untouched; the real module stays available as `_requests` for the RequestException/Response references. Sessions are per-module rather than shared because the tests use sequence-consuming side_effect lists, where one module could otherwise eat another's queued response. Transient failures now retry, restricted to GET: a PUT here carries a Contents-API sha, and replaying one whose response was merely lost would write against a stale precondition on a remote the phone also reads. Also thread timeout_seconds through firebase_client_for, which accepted none, so a caller's tighter budget silently reached the GitHub backend only. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VCucBhUkHBBHHbsY7bSdGV |
||
|---|---|---|
| .. | ||
| tests | ||
| __init__.py | ||
| _config.py | ||
| _device.py | ||
| _firebase_auth.py | ||
| _firebase.py | ||
| _github.py | ||
| _hlc.py | ||
| _http.py | ||
| _log.py | ||
| _mirror.py | ||
| _record.py | ||
| _remote.py | ||
| _store.py | ||
| _sync.py | ||