Summary
The C# module Runtime still clamps HttpRequest.Timeout to 500ms in guest code before the request reaches the host. The host (PR #4630) already uses 30s default / 180s max, so C# modules cannot request a 30–180s timeout for HttpRequests. Omitting Timeout uses the host default (~30s) and works; setting any longer value makes the call fail in ~500ms.
Environment
- SpacetimeDB CLI / host: 2.7.1
- NuGet
SpacetimeDB.Runtime: same version as the module (reproduced on 2.8.1 source)
- Language: C# procedure +
ctx.Http.Send
Evidence
crates/bindings-csharp/Runtime/Http.cs (tag v2.8.1):
private static readonly TimeSpan MaxTimeout = TimeSpan.FromMilliseconds(500);
- Comments still say the host clamps to 500ms
Send(): if request.Timeout is set and > MaxTimeout, it is replaced with 500ms before procedure_http_request
Host change: #4630 (HTTP_DEFAULT_TIMEOUT 30s, HTTP_MAX_TIMEOUT 180s). C# guest clamp was not updated to match.
Workaround
Do not set HttpRequest.Timeout (pass null). The host then applies its default (~30s). This is insufficient for slow HttpRequest calls.
Expected
C# MaxTimeout (and docs on HttpRequest.Timeout) should match the host ceiling (180s), or at least not clamp below the host max. Setting Timeout = TimeSpan.FromSeconds(60) should result in a 60s host timeout, not 500ms.
Related
Summary
The C# module Runtime still clamps
HttpRequest.Timeoutto 500ms in guest code before the request reaches the host. The host (PR #4630) already uses 30s default / 180s max, so C# modules cannot request a 30–180s timeout for HttpRequests. OmittingTimeoutuses the host default (~30s) and works; setting any longer value makes the call fail in ~500ms.Environment
SpacetimeDB.Runtime: same version as the module (reproduced on 2.8.1 source)ctx.Http.SendEvidence
crates/bindings-csharp/Runtime/Http.cs(tagv2.8.1):private static readonly TimeSpan MaxTimeout = TimeSpan.FromMilliseconds(500);Send(): ifrequest.Timeoutis set and> MaxTimeout, it is replaced with 500ms beforeprocedure_http_requestHost change: #4630 (
HTTP_DEFAULT_TIMEOUT30s,HTTP_MAX_TIMEOUT180s). C# guest clamp was not updated to match.Workaround
Do not set
HttpRequest.Timeout(pass null). The host then applies its default (~30s). This is insufficient for slow HttpRequest calls.Expected
C#
MaxTimeout(and docs onHttpRequest.Timeout) should match the host ceiling (180s), or at least not clamp below the host max. SettingTimeout = TimeSpan.FromSeconds(60)should result in a 60s host timeout, not 500ms.Related