Increase the timeout for plugin and theme update checks based on how many are being checked. Props dd32. Fixes #25788

Built from https://develop.svn.wordpress.org/trunk@28782


git-svn-id: http://core.svn.wordpress.org/trunk@28595 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
John Blackbourn 2014-06-19 23:21:16 +00:00
parent 9e85d070a8
commit 6782686192
1 changed files with 20 additions and 2 deletions

View File

@ -264,8 +264,17 @@ function wp_update_plugins( $extra_stats = array() ) {
*/
$locales = apply_filters( 'plugins_update_check_locales', $locales );
if ( defined( 'DOING_CRON' ) && DOING_CRON ) {
$timeout = 30;
} elseif ( count( $plugins ) > 10 ) {
// One extra second for every 10 plugins
$timeout = 3 + intval( count( $plugins ) / 10 );
} else {
$timeout = 3;
}
$options = array(
'timeout' => ( ( defined('DOING_CRON') && DOING_CRON ) ? 30 : 3),
'timeout' => $timeout,
'body' => array(
'plugins' => json_encode( $to_send ),
'translations' => json_encode( $translations ),
@ -412,8 +421,17 @@ function wp_update_themes( $extra_stats = array() ) {
*/
$locales = apply_filters( 'themes_update_check_locales', $locales );
if ( defined( 'DOING_CRON' ) && DOING_CRON ) {
$timeout = 30;
} elseif ( count( $themes ) > 10 ) {
// One extra second for every 10 themes
$timeout = 3 + intval( count( $themes ) / 10 );
} else {
$timeout = 3;
}
$options = array(
'timeout' => ( ( defined('DOING_CRON') && DOING_CRON ) ? 30 : 3),
'timeout' => $timeout,
'body' => array(
'themes' => json_encode( $request ),
'translations' => json_encode( $translations ),