From af5f7848683c3442258f6ba0fa0acaba2f93c8a5 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Thu, 12 Nov 2015 12:46:45 -0800 Subject: [PATCH] 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 --- includes/deferred/LinksUpdate.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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() { -- 2.20.1