Dr0ptp4kt has uploaded a new change for review.

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

Change subject: WIP: DO NOT MERGE YET! Log more memcache related events in 
debug log.
......................................................................

WIP: DO NOT MERGE YET! Log more memcache related events in debug log.

* Will need to update mediawiki-config.git before pushing.
* Will need to code review, of course.

Change-Id: I41edec73e4de512bf319522fa0c4d0cd864dcd38
---
M includes/CarrierConfigStore.php
M includes/ConfigPageHooks.php
2 files changed, 22 insertions(+), 5 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ZeroRatedMobileAccess 
refs/changes/32/132132/1

diff --git a/includes/CarrierConfigStore.php b/includes/CarrierConfigStore.php
index 3f9a45c..4d337f7 100644
--- a/includes/CarrierConfigStore.php
+++ b/includes/CarrierConfigStore.php
@@ -48,14 +48,25 @@
                        // Get it from memcached
                        $value = $this->memcGet();
                        if ( $value === false ) {
+                               // potential memcache issue or it was just saved
+                               wfDebugLog( "zeromemcache", "config not in hot 
memcache:" . $this->carrierId );
                                // Get it from HTTP
                                $this->content = $this->httpGet();
-                               // Store it in memcached
-                               // Empty string is the magic value that means 
invalid config
-                               $value = $this->content === false ? '' : 
$this->content;
-                               $this->memcSet( $value );
+                               // potential memcache issue
+                               if (!$this->content) {
+                                       wfDebugLog( "zeromemcache", "config not 
available with httpGet:" . $this->carrierId );
+                               } else {
+                                       // Store it in memcached
+                                       // Empty string is the magic value that 
means invalid config
+                                       $value = $this->content;
+                                       wfDebugLog( "zeromemcache", "after 
httpGet, {$this->carrierId}:\n$value" );
+                                       $setStatus = $this->memcSet( $value );
+                                       wfDebugLog( "zeromemcache", "after 
httpGet, memcSet, {$this->carrierId}: $setStatus" );
+                               }
+
                        } elseif ( $value === '' ) {
                                // Invalid ID was cached
+                               wfDebugLog( "zeromemcache", "invalid ID was 
cached:" . $this->carrierId );
                                $this->content = false;
                        } else {
                                // Content was cached
@@ -74,6 +85,7 @@
        private function memcGet() {
                global $wgZeroRatedMobileAccessDisableCache;
                if ( $wgZeroRatedMobileAccessDisableCache ) {
+                       wfDebugLog( "zeromemcache", "memcache is disabled, 
reading" );
                        return false;
                }
                return $this->cache->get( $this->key );
@@ -86,6 +98,7 @@
        private function memcSet( $value ) {
                global $wgZeroRatedMobileAccessDisableCache;
                if ( $wgZeroRatedMobileAccessDisableCache ) {
+                       wfDebugLog( "zeromemcache", "memcache is disabled, 
setting" );
                        return true;
                }
                return $this->cache->set( $this->key, $value );
@@ -180,7 +193,7 @@
                        'format' => 'json',
                ) );
                $options = array(
-                       'timeout' => self::LOCK_TIMEOUT * 0.4,
+                       'timeout' => self::LOCK_TIMEOUT * 0.8,
                        'connectTimeout' => 'default',
                        'method' => 'POST',
                );
diff --git a/includes/ConfigPageHooks.php b/includes/ConfigPageHooks.php
index 267a061..ba61540 100644
--- a/includes/ConfigPageHooks.php
+++ b/includes/ConfigPageHooks.php
@@ -88,8 +88,12 @@
                /** @var \WikiPage $article */
                $title = $article->getTitle();
                if ( $title && $title->inNamespace( NS_ZERO ) ) {
+                       $rev = $revision ? $revision->getId() : "(null)";
+                       $configText = $content->getNativeData();
+                       wfDebugLog( "zeromemcache", "saving/clearing cache 
starting " . $title->getText() . " at rev $rev:\n:$configText" );
                        $store = new CarrierConfigStore( $title->getText() );
                        $store->resetCache();
+                       wfDebugLog( "zeromemcache", "saving/clearing cache 
finished " . $title->getText() . " at rev $rev" );
                }
                return true;
        }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I41edec73e4de512bf319522fa0c4d0cd864dcd38
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ZeroRatedMobileAccess
Gerrit-Branch: master
Gerrit-Owner: Dr0ptp4kt <ab...@wikimedia.org>

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

Reply via email to