From: Aaron Schulz Date: Mon, 26 Mar 2018 04:04:11 +0000 (-0700) Subject: Make WikiPage::doViewUpdates use a PRESEND deferred update X-Git-Tag: 1.31.0-rc.0~268^2 X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=c6d5f531d3ab0afd03cb057e8b3d97547ff42613 Make WikiPage::doViewUpdates use a PRESEND deferred update This is better than a dubious try/catch which had the off chance of letting partial implicit transactions be committed. Change-Id: Ied4870df166dc5a8224866284ea6e1958e65f499 --- diff --git a/includes/page/WikiPage.php b/includes/page/WikiPage.php index 32953dfe48..a7305fbc71 100644 --- a/includes/page/WikiPage.php +++ b/includes/page/WikiPage.php @@ -26,7 +26,6 @@ use MediaWiki\MediaWikiServices; use Wikimedia\Assert\Assert; use Wikimedia\Rdbms\FakeResultWrapper; use Wikimedia\Rdbms\IDatabase; -use Wikimedia\Rdbms\DBError; use Wikimedia\Rdbms\DBUnexpectedError; /** @@ -1147,14 +1146,16 @@ class WikiPage implements Page, IDBAccessObject { return; } - Hooks::run( 'PageViewUpdates', [ $this, $user ] ); - // Update newtalk / watchlist notification status - try { - $user->clearNotification( $this->mTitle, $oldid ); - } catch ( DBError $e ) { - // Avoid outage if the master is not reachable - MWExceptionHandler::logException( $e ); - } + // Update newtalk / watchlist notification status; + // Avoid outage if the master is not reachable by using a deferred updated + DeferredUpdates::addCallableUpdate( + function () use ( $user, $oldid ) { + Hooks::run( 'PageViewUpdates', [ $this, $user ] ); + + $user->clearNotification( $this->mTitle, $oldid ); + }, + DeferredUpdates::PRESEND + ); } /**