From: Aaron Schulz Date: Tue, 26 Mar 2013 20:08:41 +0000 (-0700) Subject: Deferred page_touched update via onTransactionIdle. X-Git-Tag: 1.31.0-rc.0~20124 X-Git-Url: https://git.cyclocoop.org/%242?a=commitdiff_plain;h=5b77487e85899adcdb856e358f0ac16b8dbafc9f;p=lhc%2Fweb%2Fwiklou.git Deferred page_touched update via onTransactionIdle. * This should reduce deadlocks and lock wait timeouts. Change-Id: I595bc33d7643e7964d796b1d3da31f7cfab55024 --- 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;