Add try…catch in failing deferred update

This code is throwing exception for as yet uncertain reasons, which
may cause other updates to not be executed (e.g. Echo notifications).
Put a try…catch around it while we investigate.

Bug: T315383
Change-Id: Ic7aba32369f69c2e8165d5d6d25687a4cb6e0be8
This commit is contained in:
Bartosz Dziewoński 2022-08-17 02:18:44 +02:00
parent 38ff32c0e7
commit ee4e75cbf5

View file

@ -14,6 +14,8 @@ use MediaWiki\Extension\DiscussionTools\ThreadItemStore;
use MediaWiki\Revision\RenderedRevision;
use MediaWiki\Storage\Hook\RevisionDataUpdatesHook;
use MWCallableUpdate;
use MWExceptionHandler;
use Throwable;
use Title;
class DataUpdatesHooks implements RevisionDataUpdatesHook {
@ -44,8 +46,13 @@ class DataUpdatesHooks implements RevisionDataUpdatesHook {
$rev = $renderedRevision->getRevision();
if ( HookUtils::isAvailableForTitle( $title ) ) {
$updates[] = new MWCallableUpdate( function () use ( $rev ) {
$threadItemSet = HookUtils::parseRevisionParsoidHtml( $rev );
$this->threadItemStore->insertThreadItems( $rev, $threadItemSet );
try {
$threadItemSet = HookUtils::parseRevisionParsoidHtml( $rev );
$this->threadItemStore->insertThreadItems( $rev, $threadItemSet );
} catch ( Throwable $e ) {
// Catch errors, so that they don't cause other updates to fail (T315383), but log them.
MWExceptionHandler::logException( $e );
}
}, __METHOD__ );
}
}