From 5b77487e85899adcdb856e358f0ac16b8dbafc9f Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Tue, 26 Mar 2013 13:08:41 -0700 Subject: [PATCH] Deferred page_touched update via onTransactionIdle. * This should reduce deadlocks and lock wait timeouts. Change-Id: I595bc33d7643e7964d796b1d3da31f7cfab55024 --- includes/Title.php | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/includes/Title.php b/includes/Title.php index 5ce742c6b6..a40e4445c9 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -4501,23 +4501,30 @@ class Title { */ public function invalidateCache() { global $wgMemc; + if ( wfReadOnly() ) { return false; } + $dbw = wfGetDB( DB_MASTER ); - $success = $dbw->update( - 'page', - array( 'page_touched' => $dbw->timestamp() ), - $this->pageCond(), - __METHOD__ - ); + $conds = $this->pageCond(); + $dbw->onTransactionIdle( function() use ( $dbw, $conds ) { + $dbw->update( + 'page', + array( 'page_touched' => $dbw->timestamp() ), + $conds, + __METHOD__ + ); + } ); HTMLFileCache::clearFileCache( $this ); // Clear page info. $revision = WikiPage::factory( $this )->getRevision(); - if( $revision !== null ) { + if ( $revision !== null ) { $memcKey = wfMemcKey( 'infoaction', $this->getPrefixedText(), $revision->getId() ); - $success = $success && $wgMemc->delete( $memcKey ); + $success = $wgMemc->delete( $memcKey ); + } else { + $success = true; } return $success; -- 2.20.1