BryanDavis has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/333287 )

Change subject: ApiListNovaInstances: only update memc on cache miss
......................................................................

ApiListNovaInstances: only update memc on cache miss

Move the memc->set() inside the cache miss handling block. With it
outside the miss block we are effectively caching forever as long as the
api is being polled more frequently than once every 60 seconds. This is
most likely to show up when someone is testing the api and will confuse
them greatly.

Change-Id: I33c67565c1611ee92ecdc2e7d47657d4be0ae7a3
---
M api/ApiListNovaInstances.php
1 file changed, 2 insertions(+), 3 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/OpenStackManager 
refs/changes/87/333287/1

diff --git a/api/ApiListNovaInstances.php b/api/ApiListNovaInstances.php
index eaa6180..31d293d 100644
--- a/api/ApiListNovaInstances.php
+++ b/api/ApiListNovaInstances.php
@@ -53,10 +53,9 @@
                                        'imageid' => $instance->getImageId(),
                                );
                        }
+                       // Cache info for 1 minute, not longer since we do not 
invalidate
+                       $wgMemc->set( $key, $instancesInfo, 60 );
                }
-
-               // Cache info for 1 minute, not caching for longer since we do 
not invalidate
-               $wgMemc->set( $key, $instancesInfo, 1 * 60 );
 
                foreach ( $instancesInfo as $info ) {
                        // UGH I hate XML

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I33c67565c1611ee92ecdc2e7d47657d4be0ae7a3
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/OpenStackManager
Gerrit-Branch: master
Gerrit-Owner: BryanDavis <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to