From 77ded453496b8381fe0040c53ad3ca9e0699f2a6 Mon Sep 17 00:00:00 2001 From: clockwork-labs-bot Date: Thu, 12 Mar 2026 21:33:44 -0400 Subject: [PATCH 1/2] docs: Fix incorrect HTTP timeout info in procedures page The note inside the C++ tab claimed 'All timeouts are clamped to a maximum of 500ms by the host.' This was incorrect and misleading: - 500ms is the DEFAULT timeout when none is specified - The actual maximum is 10 seconds (HTTP_MAX_TIMEOUT) - This applies to all languages, not just C++ Moved the note outside the language tabs and corrected the values to match the actual code in instance_env.rs. --- .../00200-functions/00400-procedures.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/docs/00200-core-concepts/00200-functions/00400-procedures.md b/docs/docs/00200-core-concepts/00200-functions/00400-procedures.md index b769b55a4b4..eb33d7abb07 100644 --- a/docs/docs/00200-core-concepts/00200-functions/00400-procedures.md +++ b/docs/docs/00200-core-concepts/00200-functions/00400-procedures.md @@ -873,15 +873,15 @@ SPACETIMEDB_PROCEDURE(Unit, get_request_with_short_timeout, ProcedureContext ctx } ``` -:::note -All timeouts are clamped to a maximum of 500ms by the host. -::: - Procedures can't send requests at the same time as holding open a [transaction](#accessing-the-database). +:::note +If no timeout is specified, HTTP requests default to 500ms. User-specified timeouts are clamped to a maximum of 10 seconds by the host. +::: + ## Calling Reducers from Procedures Procedures can call reducers by invoking them within a transaction block. The reducer function runs within the transaction context: From fcfc423220865effc882de57cab5f282bf8d7d70 Mon Sep 17 00:00:00 2001 From: clockwork-labs-bot Date: Fri, 13 Mar 2026 01:59:01 -0400 Subject: [PATCH 2/2] =?UTF-8?q?Bump=20HTTP=20procedure=20timeouts:=20500ms?= =?UTF-8?q?/10s=20=E2=86=92=2030s/180s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous defaults (500ms default, 10s max) were far too restrictive for real-world use cases, especially LLM/AI API calls which routinely take 30-120 seconds. - Default timeout (no timeout specified): 500ms → 30s - Maximum timeout (user-specified clamp): 10s → 180s These values are in line with comparable platforms: - Supabase Edge Functions: 150-400s total execution - Vercel Functions: 60-300s total execution - Convex actions: 120s limit --- crates/core/src/host/instance_env.rs | 10 +++++++--- .../00200-functions/00400-procedures.md | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/crates/core/src/host/instance_env.rs b/crates/core/src/host/instance_env.rs index a47f035cf34..0efcd59014c 100644 --- a/crates/core/src/host/instance_env.rs +++ b/crates/core/src/host/instance_env.rs @@ -970,12 +970,16 @@ impl InstanceEnv { /// Default timeout for HTTP requests performed by [`InstanceEnv::http_request`]. /// -/// Value chosen arbitrarily by pgoldman 2025-11-18, based on little more than a vague guess. -const HTTP_DEFAULT_TIMEOUT: Duration = Duration::from_millis(500); +/// Applied when the module does not specify a timeout. +/// 30 seconds is generous enough for most external API calls (including LLM APIs) +/// without silently hanging forever on a broken endpoint. +const HTTP_DEFAULT_TIMEOUT: Duration = Duration::from_secs(30); /// Maximum timeout for HTTP requests performed by [`InstanceEnv::http_request`]. /// /// If the user requests a timeout longer than this, we will clamp to this value. -const HTTP_MAX_TIMEOUT: Duration = Duration::from_secs(10); +/// 180 seconds accommodates long-running LLM and AI API calls, +/// which routinely take 30-120 seconds for complex requests. +const HTTP_MAX_TIMEOUT: Duration = Duration::from_secs(180); const BLOCKED_HTTP_ADDRESS_ERROR: &str = "refusing to connect to private or special-purpose addresses"; struct FilteredDnsResolver; diff --git a/docs/docs/00200-core-concepts/00200-functions/00400-procedures.md b/docs/docs/00200-core-concepts/00200-functions/00400-procedures.md index eb33d7abb07..97cab79bb07 100644 --- a/docs/docs/00200-core-concepts/00200-functions/00400-procedures.md +++ b/docs/docs/00200-core-concepts/00200-functions/00400-procedures.md @@ -879,7 +879,7 @@ Procedures can't send requests at the same time as holding open a [transaction]( :::note -If no timeout is specified, HTTP requests default to 500ms. User-specified timeouts are clamped to a maximum of 10 seconds by the host. +If no timeout is specified, HTTP requests default to 30 seconds. User-specified timeouts are clamped to a maximum of 180 seconds by the host. ::: ## Calling Reducers from Procedures