Making WordPress.org

Changeset 10230


Ignore:
Timestamp:
09/02/2020 04:41:58 AM (6 years ago)
Author:
dd32
Message:

Plugin Directory: Jobs: Meta Sync: Run the sync twice hourly, and only sync download counts that have changed more than 10.

This is a performance boost for the ElasticSearch syncing which can have many thousands of plugins updating the download count by 1 every hour, which slows down indexing for everything else.

Location:
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/jobs
Files:
2 edited

Legend:

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

    r10209 r10230  
    241241        public function register_cron_tasks() {
    242242                if ( ! wp_next_scheduled( 'plugin_directory_meta_sync' ) ) {
    243                         wp_schedule_event( time() + 60, 'hourly', 'plugin_directory_meta_sync' );
     243                        wp_schedule_event( time() + 60, 'half_hourly', 'plugin_directory_meta_sync' );
    244244                }
    245245                if ( ! wp_next_scheduled( 'plugin_directory_plugin_support_resolved' ) ) {
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/jobs/class-meta-sync.php

    r9285 r10230  
    4141                        "SELECT p.id as post_id, downloads
    4242                        FROM `{$wpdb->posts}` p
    43                                 JOIN `{$download_count_table}` c on p.post_name = c.plugin_slug
     43                                JOIN `{$download_count_table}` c ON p.post_name = c.plugin_slug
    4444                                LEFT JOIN `{$wpdb->postmeta}` pm ON p.id = pm.post_id AND pm.meta_key = 'downloads'
    4545
    4646                        WHERE
    47                                 downloads != pm.meta_value OR
    48                                 pm.meta_id IS NULL"
     47                                pm.meta_id IS NULL
     48                                OR
     49                                downloads - pm.meta_value > 10
     50                        "
    4951                );
    5052
Note: See TracChangeset for help on using the changeset viewer.