From 6bd5e4f84a627d175cb1f2396b6dba85569d491f Mon Sep 17 00:00:00 2001 From: Phillip Tarrant Date: Fri, 10 Jul 2026 15:03:29 -0500 Subject: [PATCH] fix(client): HttpTransport sets request timeout (no more infinite hang) --- client/scripts/net/http_transport.gd | 4 ++++ client/tests/unit/test_net_primitives.gd | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/client/scripts/net/http_transport.gd b/client/scripts/net/http_transport.gd index dbd768c..eac8f8b 100644 --- a/client/scripts/net/http_transport.gd +++ b/client/scripts/net/http_transport.gd @@ -14,6 +14,10 @@ var _http: HTTPRequest func _init(http: HTTPRequest) -> void: _http = http + # Bound a hung proxy so the request completes with RESULT_TIMEOUT (→ failed() + # → the service degrades) instead of never returning. Without this the + # considering-state indicator would rotate forever on a hang. + _http.timeout = ProxyConfig.request_timeout_seconds() func post_json(path: String, body: Dictionary) -> DmResponse: diff --git a/client/tests/unit/test_net_primitives.gd b/client/tests/unit/test_net_primitives.gd index b26f64c..df83615 100644 --- a/client/tests/unit/test_net_primitives.gd +++ b/client/tests/unit/test_net_primitives.gd @@ -78,3 +78,13 @@ func test_request_timeout_override_and_reject_nonpositive(): ProjectSettings.set_setting(ProxyConfig.TIMEOUT_SETTING, 0.0) assert_eq(ProxyConfig.request_timeout_seconds(), ProxyConfig.TIMEOUT_DEFAULT) ProjectSettings.clear(ProxyConfig.TIMEOUT_SETTING) + + +func test_http_transport_sets_request_timeout(): + var HttpTransport = preload("res://scripts/net/http_transport.gd") + var ProxyConfig = preload("res://scripts/net/proxy_config.gd") + var http := HTTPRequest.new() + autofree(http) + HttpTransport.new(http) + assert_eq(http.timeout, ProxyConfig.request_timeout_seconds()) + assert_gt(http.timeout, 0.0) # the whole point — no longer disabled