Reduced the rate of RecentChangesUpdateJob insertion
authorAaron Schulz <aschulz@wikimedia.org>
Fri, 15 May 2015 23:00:00 +0000 (16:00 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Fri, 15 May 2015 23:00:00 +0000 (16:00 -0700)
Change-Id: Ic7db658f45365ca8ddf7f9dc807a30bc707fe517

includes/page/WikiPage.php

index 7b33b02..2098bec 100644 (file)
@@ -2206,12 +2206,14 @@ class WikiPage implements Page, IDBAccessObject {
                Hooks::run( 'ArticleEditUpdates', array( &$this, &$editInfo, $options['changed'] ) );
 
                if ( Hooks::run( 'ArticleEditUpdatesDeleteFromRecentchanges', array( &$this ) ) ) {
-                       JobQueueGroup::singleton()->push( array(
-                               // Flush old entries from the `recentchanges` table
-                               RecentChangesUpdateJob::newPurgeJob(),
-                               // Update the cached list of active users
-                               RecentChangesUpdateJob::newCacheUpdateJob()
-                       ) );
+                       // Update the cached list of active users
+                       $jobs = array( RecentChangesUpdateJob::newCacheUpdateJob() );
+                       // Flush old entries from the `recentchanges` table
+                       if ( mt_rand( 0, 9 ) == 0 ) {
+                               $jobs[] = RecentChangesUpdateJob::newPurgeJob();
+                       }
+
+                       JobQueueGroup::singleton()->push( $jobs );
                }
 
                if ( !$this->exists() ) {