Skip to content

Commit fdcc29d

Browse files
committed
Merge pull request godotengine#112686 from Calinou/httprequest-timeout-ignore-time-scale
Fix HTTPRequest timeout being scaled with `Engine.time_scale`
2 parents 8aec3e8 + b7f537c commit fdcc29d

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

doc/classes/HTTPRequest.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,8 @@
253253
Maximum number of allowed redirects.
254254
</member>
255255
<member name="timeout" type="float" setter="set_timeout" getter="get_timeout" default="0.0">
256-
The duration to wait in seconds before a request times out. If [member timeout] is set to [code]0.0[/code] then the request will never time out. For simple requests, such as communication with a REST API, it is recommended that [member timeout] is set to a value suitable for the server response time (e.g. between [code]1.0[/code] and [code]10.0[/code]). This will help prevent unwanted timeouts caused by variation in server response times while still allowing the application to detect when a request has timed out. For larger requests such as file downloads it is suggested the [member timeout] be set to [code]0.0[/code], disabling the timeout functionality. This will help to prevent large transfers from failing due to exceeding the timeout value.
256+
The duration to wait before a request times out, in seconds (independent of [member Engine.time_scale]). If [member timeout] is set to [code]0.0[/code], the request will never time out.
257+
For simple requests, such as communication with a REST API, it is recommended to set [member timeout] to a value suitable for the server response time (commonly between [code]1.0[/code] and [code]10.0[/code]). This will help prevent unwanted timeouts caused by variation in response times while still allowing the application to detect when a request has timed out. For larger requests such as file downloads, it is recommended to set [member timeout] to [code]0.0[/code], disabling the timeout functionality. This will help prevent large transfers from failing due to exceeding the timeout value.
257258
</member>
258259
<member name="use_threads" type="bool" setter="set_use_threads" getter="is_using_threads" default="false">
259260
If [code]true[/code], multithreading is used to improve performance.

scene/main/http_request.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -667,6 +667,7 @@ HTTPRequest::HTTPRequest() {
667667
tls_options = TLSOptions::client();
668668
timer = memnew(Timer);
669669
timer->set_one_shot(true);
670+
timer->set_ignore_time_scale(true);
670671
timer->connect("timeout", callable_mp(this, &HTTPRequest::_timeout));
671672
add_child(timer);
672673
}

0 commit comments

Comments
 (0)