Aaron Schulz has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/206913

Change subject: Fixed getLagTimes() locking
......................................................................

Fixed getLagTimes() locking

* Previously it deleted the value it just cached due to a missing suffix,
  which would lead to connection spam to get the new lag values.

Change-Id: I1040b2b87d3d4ddd7c368291cab87daf4227c2d0
---
M includes/db/LoadMonitor.php
M includes/libs/objectcache/BagOStuff.php
2 files changed, 3 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/13/206913/1

diff --git a/includes/db/LoadMonitor.php b/includes/db/LoadMonitor.php
index 91840dd..3d853cb 100644
--- a/includes/db/LoadMonitor.php
+++ b/includes/db/LoadMonitor.php
@@ -115,10 +115,10 @@
                }
 
                # Cache key missing or expired
-               if ( $cache->add( "$memcKey:lock", 1, 10 ) ) {
+               if ( $cache->lock( $memcKey, 0, 10 ) ) {
                        # Let this process alone update the cache value
                        $unlocker = new ScopedCallback( function () use ( 
$cache, $memcKey ) {
-                               $cache->delete( $memcKey );
+                               $cache->unlock( $memcKey );
                        } );
                } elseif ( is_array( $times ) ) {
                        # Could not acquire lock but an old cache exists, so 
use it
diff --git a/includes/libs/objectcache/BagOStuff.php 
b/includes/libs/objectcache/BagOStuff.php
index 5447ee7..a34b265 100644
--- a/includes/libs/objectcache/BagOStuff.php
+++ b/includes/libs/objectcache/BagOStuff.php
@@ -205,7 +205,7 @@
 
        /**
         * @param string $key
-        * @param int $timeout Lock wait timeout [optional]
+        * @param int $timeout Lock wait timeout; 0 for non-blocking [optional]
         * @param int $expiry Lock expiry [optional]
         * @return bool Success
         */

-- 
To view, visit https://gerrit.wikimedia.org/r/206913
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1040b2b87d3d4ddd7c368291cab87daf4227c2d0
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <asch...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to