From 9e50d6e999d02b4f8f0e90d6c5d93a866d0b1904 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Wed, 15 Apr 2015 20:34:51 -0700 Subject: [PATCH] Try to reduce stale cache updates in User::saveSettings() Bug: T95839 Change-Id: I4dc87697448b833ea575cbb3e05c92c7160d03f9 --- includes/User.php | 8 ++++++++ 1 file changed, 8 insertions(+) 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(); + } ); } /** -- 2.20.1