From: Aaron Schulz Date: Wed, 2 May 2018 00:22:33 +0000 (-0700) Subject: Use AutoCommitUpdate in LinksUpdate::doUpdate X-Git-Tag: 1.34.0-rc.0~5533^2 X-Git-Url: http://git.cyclocoop.org/%24action?a=commitdiff_plain;h=8659c59dcfa7d7b1be83d6048ef477757f38047e;p=lhc%2Fweb%2Fwiklou.git Use AutoCommitUpdate in LinksUpdate::doUpdate The hook handlers are likely to write to secondary databases, in which case it is better to wrap the callback in its own transaction round. This lowers the chance of pending write warnings happening in runMasterTransactionIdleCallbacks() as well as DBTransactionError exceptions in LBFactory due to recursion during commit. Bug: T191282 Bug: T193668 Change-Id: Ie207ca312888b6bb076f783d41f05b701f70a52e --- diff --git a/includes/deferred/LinksUpdate.php b/includes/deferred/LinksUpdate.php index 8913642891..4ddd15117b 100644 --- a/includes/deferred/LinksUpdate.php +++ b/includes/deferred/LinksUpdate.php @@ -177,15 +177,16 @@ class LinksUpdate extends DataUpdate implements EnqueueableDataUpdate { // Commit and release the lock (if set) ScopedCallback::consume( $scopedLock ); - // Run post-commit hooks without DBO_TRX - $this->getDB()->onTransactionIdle( + // Run post-commit hook handlers without DBO_TRX + DeferredUpdates::addUpdate( new AutoCommitUpdate( + $this->getDB(), + __METHOD__, function () { // Avoid PHP 7.1 warning from passing $this by reference $linksUpdate = $this; Hooks::run( 'LinksUpdateComplete', [ &$linksUpdate, $this->ticket ] ); - }, - __METHOD__ - ); + } + ) ); } /**