Repository navigation
v2.6.2
What's Fixed
Proactive TTFT timer that fires when a provider sends no data at all. The TTFT timeout check in consume_stream only ran when a chunk arrived — if the provider sent nothing for 31 seconds then sent content, the check never got a chance to fire because first_token was set by the very chunk that triggered the check. The request succeeded with ttft=31.119s despite the 10-second TTFT threshold.
consume_stream now starts a background timer thread that closes the http connection after ttft_timeout seconds if no first token has arrived. This breaks read_body out of its blocking wait. The IOError from the closed socket is caught and converted to TTFTTimeoutError, which retries like any failure. The timer is cancelled as soon as first_token is set.
Stale pooled connections still fail fast with EOFError — the timer only fires on genuinely slow connections (socket alive, no data for ttft_timeout seconds). read_timeout is not lowered; the previous approach of lowering it (commit bf4c545, reverted in 57129b4) broke the EOFError retry path on stale connections.