jenkins-bot has submitted this change and it was merged.
Change subject: Completely defer EditPage::updateWatchlist
......................................................................
Completely defer EditPage::updateWatchlist
This should reduce their profile time shown on xenon
Change-Id: I8e92de22755b592cc7b2d3fab36cff2761ab2bb7
---
M includes/EditPage.php
1 file changed, 14 insertions(+), 14 deletions(-)
Approvals:
Gilles: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/EditPage.php b/includes/EditPage.php
index 81f35f9..2bddc3e 100644
--- a/includes/EditPage.php
+++ b/includes/EditPage.php
@@ -2041,7 +2041,7 @@
}
/**
- * @param Title $title
+ * @param User $user
* @param string $oldModel
* @param string $newModel
* @param string $reason
@@ -2059,26 +2059,26 @@
$log->publish( $logid );
}
-
/**
* Register the change of watch status
*/
protected function updateWatchlist() {
global $wgUser;
- if ( $wgUser->isLoggedIn()
- && $this->watchthis != $wgUser->isWatched(
$this->mTitle, WatchedItem::IGNORE_USER_RIGHTS )
- ) {
- $fname = __METHOD__;
- $title = $this->mTitle;
- $watch = $this->watchthis;
-
- // Do this in its own transaction to reduce
contention...
- $dbw = wfGetDB( DB_MASTER );
- $dbw->onTransactionIdle( function () use ( $dbw,
$title, $watch, $wgUser, $fname ) {
- WatchAction::doWatchOrUnwatch( $watch, $title,
$wgUser );
- } );
+ if ( !$wgUser->isLoggedIn() ) {
+ return;
}
+
+ $user = $wgUser;
+ $title = $this->mTitle;
+ $watch = $this->watchthis;
+ // Do this in its own transaction to reduce contention...
+ DeferredUpdates::addCallableUpdate( function () use ( $user,
$title, $watch ) {
+ if ( $watch == $user->isWatched( $title,
WatchedItem::IGNORE_USER_RIGHTS ) ) {
+ return; // nothing to change
+ }
+ WatchAction::doWatchOrUnwatch( $watch, $title, $user );
+ } );
}
/**
--
To view, visit https://gerrit.wikimedia.org/r/249061
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I8e92de22755b592cc7b2d3fab36cff2761ab2bb7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Gilles <[email protected]>
Gerrit-Reviewer: Jackmcbarn <[email protected]>
Gerrit-Reviewer: Tpt <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits