Opened 4 years ago
Last modified 2 years ago
#52631 new enhancement
ability to override http 'connect_timeout'
Reported by: | bdanchilla | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | 5.6.2 |
Component: | HTTP API | Keywords: | |
Focuses: | Cc: |
Description
The default is 10s which is too long for my usage. Ability to override in the same manner 'timeout' can be overridden.
Note: See
TracTickets for help on using
tickets.
Thank you for your contribution, @bdanchilla. Please don't get scared by my notes further down :) I am just thinking about possible negative implications as changing networking code affects a lot of functionality.
Current default value for the
connect_timeout
is 10 seconds:https://github.com/WordPress/wordpress-develop/blob/trunk/src/wp-includes/class-requests.php#L507
Changing it to 2 seconds could cause problems to the existing implementations (plugins). I would recommend going with 10 seconds as the default.
I noticed that the defaults are defined in 2 separate places:
WP_Http::request()
Requests::get_default_options()
The only reason I mention is to make sure we define them in the correct place -
WP_Http
.Do you have any thoughts on the default
connect_timeout
value, @desrosj or @xknown?Let's also consider automated testing of this. I couldn't find any existing tests for the
timeout
parameter. I assume it is quite tricky to replicate the delay. It would also slow the tests down.