jenkins-bot has submitted this change and it was merged.

Change subject: Defer some updates in doEditUpdates()
......................................................................


Defer some updates in doEditUpdates()

* These updates add to editing time and can be done
  after sending the HTTP response for performance
* Also improved the active users job insertion logic

Change-Id: I5b25217c4f08db7fa9a05eac046283f02d45865e
---
M includes/changes/RecentChange.php
M includes/page/WikiPage.php
2 files changed, 10 insertions(+), 7 deletions(-)

Approvals:
  Ori.livneh: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/changes/RecentChange.php 
b/includes/changes/RecentChange.php
index b430bab..aa210e3 100644
--- a/includes/changes/RecentChange.php
+++ b/includes/changes/RecentChange.php
@@ -332,6 +332,11 @@
                                        $this->mExtra['pageStatus'] );
                        }
                }
+
+               // Update the cached list of active users
+               if ( $this->mAttribs['rc_user'] > 0 ) {
+                       JobQueueGroup::singleton()->lazyPush( 
RecentChangesUpdateJob::newCacheUpdateJob() );
+               }
        }
 
        /**
diff --git a/includes/page/WikiPage.php b/includes/page/WikiPage.php
index 64dd99d..71b3b79 100644
--- a/includes/page/WikiPage.php
+++ b/includes/page/WikiPage.php
@@ -1836,6 +1836,7 @@
                                        // Mark as patrolled if the user can do 
so
                                        $patrolled = $wgUseRCPatrol && !count(
                                        
$this->mTitle->getUserPermissionsErrors( 'autopatrol', $user ) );
+
                                        // Add RC row to the DB
                                        $rc = RecentChange::notifyEdit( $now, 
$this->mTitle, $isminor, $user, $summary,
                                                $oldid, $this->getTimestamp(), 
$bot, '', $oldsize, $newsize,
@@ -2193,20 +2194,18 @@
                        $recursive = $options['changed']; // bug 50785
                        $updates = $content->getSecondaryDataUpdates(
                                $this->getTitle(), null, $recursive, 
$editInfo->output );
-                       DataUpdate::runUpdates( $updates );
+                       foreach ( $updates as $update ) {
+                               DeferredUpdates::addUpdate( $update );
+                       }
                }
 
                Hooks::run( 'ArticleEditUpdates', array( &$this, &$editInfo, 
$options['changed'] ) );
 
                if ( Hooks::run( 'ArticleEditUpdatesDeleteFromRecentchanges', 
array( &$this ) ) ) {
-                       // 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()->lazyPush( 
RecentChangesUpdateJob::newPurgeJob() );
                        }
-
-                       JobQueueGroup::singleton()->lazyPush( $jobs );
                }
 
                if ( !$this->exists() ) {
@@ -2275,7 +2274,6 @@
                } elseif ( $options['changed'] ) { // bug 50785
                        self::onArticleEdit( $this->mTitle );
                }
-
        }
 
        /**

-- 
To view, visit https://gerrit.wikimedia.org/r/211888
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I5b25217c4f08db7fa9a05eac046283f02d45865e
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <asch...@wikimedia.org>
Gerrit-Reviewer: Legoktm <legoktm.wikipe...@gmail.com>
Gerrit-Reviewer: Ori.livneh <o...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to