Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(184)

Unified Diff: chrome/common/extensions/docs/server2/memcache_object_store.py

Issue 658733004: Docserver: Make ObjectStore set calls return Futures (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix, cleanup Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/docs/server2/memcache_object_store.py
diff --git a/chrome/common/extensions/docs/server2/memcache_object_store.py b/chrome/common/extensions/docs/server2/memcache_object_store.py
index 78d924166b3ff3da33d6632d81886b23d109e3a9..9f1a4250661f1c1bc346a9c217209126b3c6d563 100644
--- a/chrome/common/extensions/docs/server2/memcache_object_store.py
+++ b/chrome/common/extensions/docs/server2/memcache_object_store.py
@@ -5,9 +5,10 @@
import logging
from appengine_wrappers import memcache
+from future import Future
from object_store import ObjectStore
-class _AsyncMemcacheGetFuture(object):
+class _AsyncMemcacheIOFuture(object):
def __init__(self, rpc):
self._rpc = rpc
@@ -22,16 +23,18 @@ class MemcacheObjectStore(ObjectStore):
# talking_alarm_clock always fails because the zip is too big.
# TODO(kalman): store example zips in blobstore.
if any(key.find('talking_alarm_clock') != -1 for key in mapping.iterkeys()):
- return
+ return Future(value=None)
try:
- memcache.Client().set_multi_async(mapping, namespace=self._namespace)
+ rpc = memcache.Client().set_multi_async(mapping,
+ namespace=self._namespace)
+ return _AsyncMemcacheIOFuture(rpc)
except ValueError as e:
logging.error('Caught "ValueError: %s" when mapping keys %s' % (
e, mapping.keys()))
def GetMulti(self, keys):
rpc = memcache.Client().get_multi_async(keys, namespace=self._namespace)
- return _AsyncMemcacheGetFuture(rpc)
+ return _AsyncMemcacheIOFuture(rpc)
def DelMulti(self, keys):
memcache.delete_multi(keys, namespace=self._namespace)

Powered by Google App Engine
This is Rietveld 408576698