Conversation
Increase read and total timeout from 60s/120s to 900s (15 minutes) to better handle long-running proxy requests.
There was a problem hiding this comment.
Pull request overview
This PR increases the httpx timeout configuration in the proxy's HTTP client from 60s/120s (default/read) to 900s (15 minutes) to accommodate long-running requests when proxying to the Anthropic API. This is a configuration change to better handle streaming responses and tool invocations that may take significant time to complete.
Key changes:
- Increased default timeout from 60s to 900s (15 minutes)
- Increased read timeout from 120s to 900s (15 minutes)
- Increased connect timeout from 10s to 30s
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| self._client = httpx.AsyncClient( | ||
| base_url=base_url, | ||
| timeout=httpx.Timeout(60.0, connect=10.0, read=120.0), | ||
| timeout=httpx.Timeout(900.0, connect=30.0, read=900.0), |
There was a problem hiding this comment.
The httpx.Timeout constructor signature is Timeout(timeout=None, connect=None, read=None, write=None, pool=None) where the first positional argument is the default timeout. Setting both the default (900s) and read (900s) to the same value is redundant. Consider either using only the default timeout httpx.Timeout(900.0, connect=30.0) or explicitly setting write timeout as well if needed: httpx.Timeout(connect=30.0, read=900.0, write=900.0).
| timeout=httpx.Timeout(900.0, connect=30.0, read=900.0), | |
| timeout=httpx.Timeout(900.0, connect=30.0), |
Increase read and total timeout from 60s/120s to 900s (15 minutes) to better handle long-running proxy requests.