#timeout Clear
Tags #php #kotlin #bash #go #sql #rust #typescript #html #java #python #files #utils #strings #http #concurrency #async #json #arrays #security #types #crypto #database #dates #format
Python requests Session with Retry + Timeouts
A pre-configured requests.Session that auto-retries 5xx + connect errors with exponential backoff, applies a default timeout, and uses connection pooling. Use this everywhere instead of bare requests.get().
TypeScript Promise with Timeout
Race a promise against a timeout — if the work takes longer than `ms`, reject with a timeout error. Cancels nothing on its own (use AbortController for that), but unblocks the caller.
Go http.Client with Timeout
`http.DefaultClient` has no timeout — a hung server can hang your whole program forever. ALWAYS use a custom client with an explicit timeout for outbound requests.
Bash Run Command with Timeout
`timeout` (GNU coreutils) kills a command after N seconds. Returns exit code 124 on timeout — let the caller distinguish "timed out" from "failed for other reasons."
Rust Async Timeout
Wrap any future in `tokio::time::timeout` to fail it if it takes too long. Returns `Err(Elapsed)` on timeout; you decide what to do next (retry, fall back, propagate).
Kotlin Coroutine Timeout with withTimeout
`withTimeout(ms) { ... }` cancels the inner coroutine if it doesn't finish in time and throws `TimeoutCancellationException`. `withTimeoutOrNull` returns null instead.
Go select — Multiplex Channel Operations
`select` is like a switch for channels — runs whichever case is ready. Use `default` for non-blocking sends/receives; `case <-time.After(d)` for timeouts.
Python asyncio.wait_for — Timeout Wrapper
Cancel a coroutine if it takes longer than `timeout` seconds. Raises asyncio.TimeoutError when fired so the caller can fall back. Python 3.11+ has asyncio.timeout() as a context-manager alternative.
Bash cURL GET with Timeout + Retry
A sensible default cURL invocation: short connect timeout, total timeout, retry on transient failures with backoff, fail-on-error.