AI News
19 Aug 2026
Read 10 min
How to increase timeout for third-party requests instantly
Increase timeout for third-party requests to prevent 500 errors and fetch external content reliably.
Why timeouts matter
Slow calls block threads, tie up connections, and raise costs. If you set timeouts too low, you break user flows. If you set them too high, you make queues pile up and harm the whole system. The right setting protects your app while giving partners room to respond.How to increase timeout for third-party requests instantly
1) Update the caller (client-side)
Change the timeout in the code that makes the HTTP call. Do this first because it gives the fastest win. – cURL: Use –max-time 50 (seconds) and optionally –connect-timeout 5 – JavaScript (Axios): axios.get(url, { timeout: 50000 }) – JavaScript (fetch): Use AbortController; cancel after setTimeout of 50,000 ms – Python (requests): requests.get(url, timeout=(5, 50)) # (connect, read) in seconds – Java (OkHttp): client.newBuilder().readTimeout(50, SECONDS).connectTimeout(5, SECONDS) – Java (HttpClient): HttpClient.newBuilder().connectTimeout(Duration.ofSeconds(5)) and per-request read timeout via executor or interceptor – .NET (HttpClient): httpClient.Timeout = TimeSpan.FromSeconds(50) Tips: – Keep connect timeout small (2–10s). Keep read timeout only as high as needed (e.g., 30–60s). – Match units. Many SDKs use seconds, but some APIs want milliseconds.2) Pass a timeout query string to your proxy
Some API gateways or content fetch services let you set a per-request timeout in the URL. If your tool supports it, add a timeout parameter in milliseconds. – Example: https://your-proxy.example/fetch?timeout=50000&url=https://api.partner.com/data – Raise it just enough to clear normal spikes. Do not set it to several minutes unless you also limit concurrency. This method helps when you cannot change client code fast but can edit URLs or config.3) Adjust server and gateway timeouts
If you own the edge or backend making the call, raise its limits as well. – Nginx: proxy_read_timeout 60s; keepalive_timeout 65s – HAProxy: timeout connect 5s; timeout server 50s; timeout client 60s – Node.js: server.requestTimeout = 60000; agent.keepAlive = true – Express/fastify: rely on Node server timeouts; use AbortController on outbound calls – Load balancer: raise idle timeout to allow the full response window Make sure the app, proxy, and load balancer all allow at least the same window; the smallest value wins.4) Add retries with backoff (but cap them)
Combine a modest timeout with 1–2 retries and exponential backoff. – Good start: timeout 15–20s, retry twice at 500ms, then 2s – Use jitter to avoid thundering herd – Respect partner rate limits Do not retry on timeouts forever. Cap total time (for example, 45–60s).5) Enable connection reuse and DNS health
Slow handshakes waste your timeout budget. – Turn on HTTP keep-alive and reuse sockets – Cache DNS responses and use fast resolvers – Prefer HTTP/2 or HTTP/3 if both sides support it6) Right-size payloads
Big responses take longer to send and parse. – Ask only for needed fields (use fields, select, or projection params) – Use compression (gzip/br) – Paginate for large listsBetter patterns than simply raising timeouts
Use async flows for long work
If the partner task can take minutes, avoid blocking the user. – Send a job request and get a task ID – Let the partner call a webhook when done, or let your app poll the task status – Show progress to the userFail soft and degrade gracefully
– Serve cached data when the live call is slow – Show partial content with a notice – Queue non-critical calls for laterGuard against runaway latency
– Set an absolute deadline per user action – Use circuit breakers to trip after repeated failures – Rate-limit background retriesHow to pick the right numbers
Start with data
– Look at P50, P90, P99 latency from the partner – Set connect timeout near P90 connect time, read timeout near P99 total time, with a small bufferConsider user tolerance
– Interactive UI: aim for under 2–3 seconds total; avoid over 10 seconds – Background sync: 30–60 seconds is often fine – Batch jobs: allow minutes, but run off the main request pathKeep the budget end-to-end
– Client timeout must be a bit higher than server timeout if client waits for server – Retries plus timeouts must not exceed your overall SLA for that actionTest, monitor, and roll back
Test
– Reproduce timeouts with a slow test server or a traffic shaper – Verify success rates improve after you increase timeout for third-party requestsMonitor
– Track latency histogram, timeout rate, retry rate, and saturation (CPU, memory, threads) – Watch for rising queue length and open connectionsRoll back
– If saturation grows or tail latency spikes, lower the timeout or cut retries – Use feature flags or config toggles for fast changesCommon quick fixes that work today
– Add ?timeout=50000 to your proxy or fetch service if supported – Raise client read timeout to 30–60 seconds; keep connect timeout small – Turn on keep-alive and compression – Add one safe retry with backoff – Cache results for repeated reads Raising the limit can stop noisy 500 errors fast. But do it with care, measure the impact, and improve the flow so you do not need to push timeouts ever higher. A short wrap-up: You can increase timeout for third-party requests by adjusting client settings, adding a timeout parameter at the proxy, and tuning server limits. Combine that with retries, caching, and async patterns to protect users and systems.(Source: https://openai.com/index/building-an-ai-native-finance-function/)
For more news: Click Here
FAQ
Contents