Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions crates/core/src/host/instance_env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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).
</TabItem>
</Tabs>
:::note
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
Procedures can call reducers by invoking them within a transaction block. The reducer function runs within the transaction context:
Expand Down
Loading