Making WordPress.org


Ignore:
Timestamp:
11/20/2019 06:59:20 AM (5 years ago)
Author:
dd32
Message:

Plugin Directory: Cron Jobs: Clear the Memcache cache within WordPress after processing lots of posts to allow Jetpack Sync to have some memory free.

This avoids plenty of post-shutdown fatals in cron tasks WordPress.org is currently experiencing and consolidates such code to a single instance.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/jobs/class-meta-sync.php

    r9140 r9284  
    2626        $this->sync_ratings();
    2727        $this->update_tested_up_to();
     28
     29        Manager::clear_memory_heavy_variables();
    2830    }
    2931
     
    167169        $tested_values             = $wpdb->get_results( "SELECT post_id, post_name, meta_value FROM {$wpdb->postmeta} pm JOIN {$wpdb->posts} p ON pm.post_id = p.ID WHERE meta_key = 'tested' AND meta_value IN( {$tested_meta_value_esc_sql} )" );
    168170
    169         foreach ( $tested_values as $row ) {
     171        foreach ( $tested_values as $i => $row ) {
    170172            update_post_meta(
    171173                $row->post_id,
     
    176178            // Update the API endpoints with the new data
    177179            API_Update_Updater::update_single_plugin( $row->post_name );
     180
     181            if ( $i % 100 === 0 ) {
     182                Manager::clear_memory_heavy_variables();
     183            }
    178184        }
    179185    }
Note: See TracChangeset for help on using the changeset viewer.