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

Side by Side Diff: chrome/common/extensions/docs/server2/memcache_object_store.py

Issue 14188041: Devserver: catch ValueError in MemcacheObjectStore.SetMulti. This is being (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import logging
6
5 from appengine_wrappers import memcache 7 from appengine_wrappers import memcache
6 from object_store import ObjectStore 8 from object_store import ObjectStore
7 9
8 class _AsyncMemcacheGetFuture(object): 10 class _AsyncMemcacheGetFuture(object):
9 def __init__(self, rpc): 11 def __init__(self, rpc):
10 self._rpc = rpc 12 self._rpc = rpc
11 13
12 def Get(self): 14 def Get(self):
13 return self._rpc.get_result() 15 return self._rpc.get_result()
14 16
15 class MemcacheObjectStore(ObjectStore): 17 class MemcacheObjectStore(ObjectStore):
16 def __init__(self, namespace): 18 def __init__(self, namespace):
17 self._namespace = namespace 19 self._namespace = namespace
18 20
19 def SetMulti(self, mapping): 21 def SetMulti(self, mapping):
20 memcache.Client().set_multi_async(mapping, namespace=self._namespace) 22 try:
23 memcache.Client().set_multi_async(mapping, namespace=self._namespace)
24 except ValueError as e:
25 logging.error('Caught "ValueError: %s" when mapping keys %s' % (
26 e, mapping.keys()))
21 27
22 def GetMulti(self, keys): 28 def GetMulti(self, keys):
23 rpc = memcache.Client().get_multi_async(keys, namespace=self._namespace) 29 rpc = memcache.Client().get_multi_async(keys, namespace=self._namespace)
24 return _AsyncMemcacheGetFuture(rpc) 30 return _AsyncMemcacheGetFuture(rpc)
25 31
26 def DelMulti(self, keys): 32 def DelMulti(self, keys):
27 memcache.delete_multi(keys, namespace=self._namespace) 33 memcache.delete_multi(keys, namespace=self._namespace)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698