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

Proposed by Jürgen Gmach
Status: Merged
Approved by: Jürgen Gmach
Approved revision: 6a99e03b30697f475f562e55cfa7a3eb8bf87834
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~jugmac00/launchpad:fix-another-pymemcache-regression
Merge into: launchpad:master
Diff against target: 36 lines (+6/-5)
2 files modified
lib/lp/app/browser/root.py (+1/-1)
lib/lp/services/memcache/testing.py (+5/-4)
Reviewer Review Type Date Requested Status
Colin Watson (community) Approve
Review via email: mp+411702@code.launchpad.net

Commit message

Update callers of Client.set

To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) wrote :

You might want to amend the commit message to say "python-memcached" rather than "python-launchpad".

review: Approve
Revision history for this message
Jürgen Gmach (jugmac00) wrote :

> You might want to amend the commit message to say "python-memcached" rather
> than "python-launchpad".

Thank you! :-)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/lib/lp/app/browser/root.py b/lib/lp/app/browser/root.py
2index 484fdb2..fa6becd 100644
3--- a/lib/lp/app/browser/root.py
4+++ b/lib/lp/app/browser/root.py
5@@ -187,7 +187,7 @@ class LaunchpadRootIndexView(HasAnnouncementsView, LaunchpadView):
6 'date': time.strftime('%d %b %Y', entry.published_parsed),
7 })
8 # The cache of posts expires after an hour.
9- getUtility(IMemcacheClient).set(key, posts, time=3600)
10+ getUtility(IMemcacheClient).set(key, posts, expire=3600)
11 return posts
12
13
14diff --git a/lib/lp/services/memcache/testing.py b/lib/lp/services/memcache/testing.py
15index 830be6b..c4809f4 100644
16--- a/lib/lp/services/memcache/testing.py
17+++ b/lib/lp/services/memcache/testing.py
18@@ -30,13 +30,14 @@ class MemcacheFixture(fixtures.Fixture):
19 else:
20 return value
21
22- def set(self, key, val, time=0):
23+ def set(self, key, val, expire=0):
24 # memcached accepts either delta-seconds from the current time or
25 # absolute epoch-seconds, and tells them apart using a magic
26 # threshold. See memcached/memcached.c:realtime.
27- if time and time <= 60 * 60 * 24 * 30:
28- time = _time.time() + time
29- self._cache[key] = (val, time)
30+ MONTH_IN_SECONDS = 60 * 60 * 24 * 30
31+ if expire and expire <= MONTH_IN_SECONDS:
32+ expire = _time.time() + expire
33+ self._cache[key] = (val, expire)
34 return 1
35
36 def delete(self, key):

Subscribers

People subscribed via source and target branches

to status/vote changes: