[wp-trac] [WordPress Trac] #33055: Support Parallel HTTP Requests in WP_Http, et al

WordPress Trac noreply at wordpress.org
Wed Jun 1 03:46:30 UTC 2016


#33055: Support Parallel HTTP Requests in WP_Http, et al
----------------------------+--------------------------
 Reporter:  wonderboymusic  |       Owner:  rmccue
     Type:  task (blessed)  |      Status:  assigned
 Priority:  high            |   Milestone:  4.6
Component:  HTTP API        |     Version:
 Severity:  normal          |  Resolution:
 Keywords:  needs-patch     |     Focuses:  performance
----------------------------+--------------------------

Comment (by rmccue):

 Replying to [comment:46 Otto42]:
 > I agree, however if you're specifying anything less than half a second,
 this code would make your timeout get set to zero:
 >
 > https://core.trac.wordpress.org/browser/trunk/src/wp-
 includes/Requests/Transport/cURL.php?rev=37428#L351
 >
 > {{{
 > curl_setopt($this->handle, CURLOPT_TIMEOUT_MS, round($options['timeout']
 * 1000));
 > }}}

 `timeout` is a float value for the number of seconds; this code multiplies
 it up to milliseconds, then rounds to the nearest millisecond.

 e.g. if I specify `'timeout' => 0.0121`, this code multiplies that up to
 `12.1`, then rounds to an integer millisecond value of `12`

 > Also, the curl documentation says that the minimum timeout allowed is 1
 second.
 >
 > https://curl.haxx.se/libcurl/c/CURLOPT_TIMEOUT_MS.html
 >
 > > If libcurl is built to use the standard system name resolver, that
 portion of the transfer will still use full-second resolution for timeouts
 with a minimum timeout allowed of one second.

 cURL internally rounds this up if necessary, and that only affects the
 name resolution (i.e. DNS), not the actual transfer time. That note is
 just a warning that specifying 1ms doesn't guarantee it'll only take 1ms
 :)

--
Ticket URL: <https://core.trac.wordpress.org/ticket/33055#comment:47>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list