launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #27709
[Merge] ~jugmac00/launchpad:fix-pymemcache-regression into launchpad:master
Jürgen Gmach has proposed merging ~jugmac00/launchpad:fix-pymemcache-regression into launchpad:master.
Commit message:
Update SnapStoreClient to work with pymemcache
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~jugmac00/launchpad/+git/launchpad/+merge/411681
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~jugmac00/launchpad:fix-pymemcache-regression into launchpad:master.
diff --git a/lib/lp/services/memcache/timeline.py b/lib/lp/services/memcache/timeline.py
index f178c87..9e1bf3e 100644
--- a/lib/lp/services/memcache/timeline.py
+++ b/lib/lp/services/memcache/timeline.py
@@ -40,12 +40,12 @@ class TimelineRecordingClient(HashClient):
finally:
action.finish()
- def set(self, key, value, time=0):
+ def set(self, key, value, expire=0):
if not self._enabled:
return None
action = self.__get_timeline_action("set", key)
try:
- success = HashClient.set(self, key, value, expire=time)
+ success = HashClient.set(self, key, value, expire=expire)
if success:
logging.debug("Memcache set succeeded for %s", key)
else:
diff --git a/lib/lp/snappy/model/snapstoreclient.py b/lib/lp/snappy/model/snapstoreclient.py
index 188b7a6..c43d705 100644
--- a/lib/lp/snappy/model/snapstoreclient.py
+++ b/lib/lp/snappy/model/snapstoreclient.py
@@ -420,7 +420,9 @@ class SnapStoreClient:
action.finish()
channels = response.json().get("_embedded", {}).get(
"clickindex:channel", [])
- expire_time = time.time() + 60 * 60 * 24
+ DAY_IN_SECONDS = 60 * 60 * 24
+ # pymemcache's `expire` expects an int
+ expire_time = int(time.time()) + DAY_IN_SECONDS
memcache_client.set(
memcache_key, json.dumps(channels), expire_time)
if channels is None: