← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~jugmac00/launchpad:fix-another-pymemcache-regression into launchpad:master

 

Jürgen Gmach has proposed merging ~jugmac00/launchpad:fix-another-pymemcache-regression into launchpad:master.

Commit message:
Update callers of Client.set

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~jugmac00/launchpad/+git/launchpad/+merge/411702
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~jugmac00/launchpad:fix-another-pymemcache-regression into launchpad:master.
diff --git a/lib/lp/app/browser/root.py b/lib/lp/app/browser/root.py
index 484fdb2..fa6becd 100644
--- a/lib/lp/app/browser/root.py
+++ b/lib/lp/app/browser/root.py
@@ -187,7 +187,7 @@ class LaunchpadRootIndexView(HasAnnouncementsView, LaunchpadView):
                 'date': time.strftime('%d %b %Y', entry.published_parsed),
                 })
         # The cache of posts expires after an hour.
-        getUtility(IMemcacheClient).set(key, posts, time=3600)
+        getUtility(IMemcacheClient).set(key, posts, expire=3600)
         return posts
 
 
diff --git a/lib/lp/services/memcache/testing.py b/lib/lp/services/memcache/testing.py
index 830be6b..c4809f4 100644
--- a/lib/lp/services/memcache/testing.py
+++ b/lib/lp/services/memcache/testing.py
@@ -30,13 +30,14 @@ class MemcacheFixture(fixtures.Fixture):
         else:
             return value
 
-    def set(self, key, val, time=0):
+    def set(self, key, val, expire=0):
         # memcached accepts either delta-seconds from the current time or
         # absolute epoch-seconds, and tells them apart using a magic
         # threshold.  See memcached/memcached.c:realtime.
-        if time and time <= 60 * 60 * 24 * 30:
-            time = _time.time() + time
-        self._cache[key] = (val, time)
+        MONTH_IN_SECONDS = 60 * 60 * 24 * 30
+        if expire and expire <= MONTH_IN_SECONDS:
+            expire = _time.time() + expire
+        self._cache[key] = (val, expire)
         return 1
 
     def delete(self, key):