Make WordPress Core

Changeset 28782


Ignore:
Timestamp:
06/19/2014 11:20:15 PM (11 years ago)
Author:
johnbillion
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/update.php

    r28500 r28782  
    265265    $locales = apply_filters( 'plugins_update_check_locales', $locales );
    266266
     267    if ( defined( 'DOING_CRON' ) && DOING_CRON ) {
     268        $timeout = 30;
     269    } elseif ( count( $plugins ) > 10 ) {
     270        // One extra second for every 10 plugins
     271        $timeout = 3 + intval( count( $plugins ) / 10 );
     272    } else {
     273        $timeout = 3;
     274    }
     275
    267276    $options = array(
    268         'timeout' => ( ( defined('DOING_CRON') && DOING_CRON ) ? 30 : 3),
     277        'timeout' => $timeout,
    269278        'body' => array(
    270279            'plugins'      => json_encode( $to_send ),
     
    413422    $locales = apply_filters( 'themes_update_check_locales', $locales );
    414423
     424    if ( defined( 'DOING_CRON' ) && DOING_CRON ) {
     425        $timeout = 30;
     426    } elseif ( count( $themes ) > 10 ) {
     427        // One extra second for every 10 themes
     428        $timeout = 3 + intval( count( $themes ) / 10 );
     429    } else {
     430        $timeout = 3;
     431    }
     432
    415433    $options = array(
    416         'timeout' => ( ( defined('DOING_CRON') && DOING_CRON ) ? 30 : 3),
     434        'timeout' => $timeout,
    417435        'body' => array(
    418436            'themes'       => json_encode( $request ),
Note: See TracChangeset for help on using the changeset viewer.