fix(auth): add HTTP timeouts to bridge-token and Client endpoints#558
fix(auth): add HTTP timeouts to bridge-token and Client endpoints#558RapidPoseidon wants to merge 1 commit intomainfrom
Conversation
`_get_bridge_tokens`, `_poll_read_key`, and `_create_client` all called `requests.*` without a `timeout=` argument. A slow or hung identity server — or a slowloris — would pin the calling thread indefinitely. The existing `poll_timeout` only caps the total polling loop, not individual requests, and the bridge/create-client calls had no cap at all. Add a shared `(connect=10s, read=30s)` pair and thread it through all three call sites. Session: https://session-bc38cc85.poseidon.rapidata.internal/ Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> Co-Authored-By: lino <lino@rapidata.ai>
Code ReviewOverviewThis PR correctly identifies and fixes a real reliability issue: all three Strengths
Issues1. Multi-line comment violates project conventions (minor)
The 4-line block on # (connect, read) pair; outer poll_timeout only bounds the loop, not individual requests.
_HTTP_TIMEOUT: Tuple[float, float] = (10.0, 30.0)2. Polling loop can exceed
|
Summary
_get_bridge_tokens,_poll_read_key, and_create_clientinCredentialManagerall hit identity endpoints withrequests.*and notimeout=. A slow/hung identity server or a deliberate slowloris holds the calling thread forever.poll_timeoutcaps the total polling loop only — a hang on any individual request still blocks forever. The bridge and create-client calls had no cap whatsoever.Fix
Single
_HTTP_TIMEOUT = (10.0, 30.0)class constant (connect, read), threaded through all three call sites.Test plan
uv run pyright src/rapidata/rapidata_client→ 0 errorsrequests.*call sites in the file now havetimeout=.🔗 Session: https://session-bc38cc85.poseidon.rapidata.internal/