Making WordPress.org

Changeset 9713


Ignore:
Timestamp:
04/10/2020 08:39:16 AM (5 years ago)
Author:
dd32
Message:

Translate: When the query times out, don't overwrite the old cached data.

See #3155.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-routes/inc/routes/class-stats.php

    r9711 r9713  
    1919    public function cache_waiting_strings() {
    2020        global $wpdb;
     21
     22        // Run the query on a primary DB server to avoid timing out.
     23        if ( method_exists( $qpdb, 'send_reads_to_masters' ) ) {
     24            $wpdb->send_reads_to_masters();
     25        }
    2126
    2227        $cached_projects = [
     
    3641        foreach ( $cached_projects as $project ) {
    3742            $rows = $wpdb->get_results( $wpdb->prepare( $sql, $project->id ) );
     43            if ( ! $rows ) {
     44                continue;
     45            }
    3846
    3947            $cached_data = [];
Note: See TracChangeset for help on using the changeset viewer.