This is better than a dubious try/catch which had the off chance
of letting partial implicit transactions be committed.
Change-Id: Ied4870df166dc5a8224866284ea6e1958e65f499
use Wikimedia\Assert\Assert;
use Wikimedia\Rdbms\FakeResultWrapper;
use Wikimedia\Rdbms\IDatabase;
use Wikimedia\Assert\Assert;
use Wikimedia\Rdbms\FakeResultWrapper;
use Wikimedia\Rdbms\IDatabase;
-use Wikimedia\Rdbms\DBError;
use Wikimedia\Rdbms\DBUnexpectedError;
/**
use Wikimedia\Rdbms\DBUnexpectedError;
/**
- 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
+ );