From: Aaron Schulz Date: Thu, 16 Apr 2015 03:34:51 +0000 (-0700) Subject: Try to reduce stale cache updates in User::saveSettings() X-Git-Tag: 1.31.0-rc.0~11685^2 X-Git-Url: https://git.cyclocoop.org/%242?a=commitdiff_plain;h=9e50d6e999d02b4f8f0e90d6c5d93a866d0b1904;p=lhc%2Fweb%2Fwiklou.git Try to reduce stale cache updates in User::saveSettings() Bug: T95839 Change-Id: I4dc87697448b833ea575cbb3e05c92c7160d03f9 --- diff --git a/includes/User.php b/includes/User.php index f862953767..59d5c03cf8 100644 --- a/includes/User.php +++ b/includes/User.php @@ -3647,6 +3647,14 @@ class User implements IDBAccessObject { Hooks::run( 'UserSaveSettings', array( $this ) ); $this->clearSharedCache(); $this->getUserPage()->invalidateCache(); + + // T95839: clear the cache again post-commit to reduce race conditions + // where stale values are written back to the cache by other threads. + // Note: this *still* doesn't deal with REPEATABLE-READ snapshot lag... + $that = $this; + $dbw->onTransactionIdle( function() use ( $that ) { + $that->clearSharedCache(); + } ); } /**