fix(client): HttpTransport sets request timeout (no more infinite hang)

This commit is contained in:
2026-07-10 15:03:29 -05:00
parent 377adb10b2
commit 6bd5e4f84a
2 changed files with 14 additions and 0 deletions

View File

@@ -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:

View File

@@ -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