From: Aaron Schulz Date: Thu, 12 Nov 2015 20:46:45 +0000 (-0800) Subject: Reduce updateLinksTimestamp() DB contention X-Git-Tag: 1.31.0-rc.0~8977^2 X-Git-Url: https://git.heureux-cyclage.org/?a=commitdiff_plain;h=af5f7848683c3442258f6ba0fa0acaba2f93c8a5;p=lhc%2Fweb%2Fwiklou.git Reduce updateLinksTimestamp() DB contention Do the LinksUpdateComplete hook updates in a separate transaction as they may do slow SELECTs and updates. A large amount of DBPerformance warnings were triggered by such cases. Bug: T95501 Change-Id: Ie4e6b7f6aefc21bafba270282c55571ff5385fe0 --- diff --git a/includes/deferred/LinksUpdate.php b/includes/deferred/LinksUpdate.php index dbfdab0d4e..a6290ed9da 100644 --- a/includes/deferred/LinksUpdate.php +++ b/includes/deferred/LinksUpdate.php @@ -145,7 +145,11 @@ class LinksUpdate extends SqlDataUpdate implements EnqueueableDataUpdate { public function doUpdate() { Hooks::run( 'LinksUpdate', array( &$this ) ); $this->doIncrementalUpdate(); - Hooks::run( 'LinksUpdateComplete', array( &$this ) ); + + $that = $this; + $this->mDb->onTransactionIdle( function() use ( $that ) { + Hooks::run( 'LinksUpdateComplete', array( &$that ) ); + } ); } protected function doIncrementalUpdate() {