Commit 4c224318 authored by Vincent Pelletier's avatar Vincent Pelletier

Don't check & fetch, just fetch and catch KeyError.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2423 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 3297d136
...@@ -432,8 +432,12 @@ class Application(object): ...@@ -432,8 +432,12 @@ class Application(object):
# Try in cache first # Try in cache first
self._cache_lock_acquire() self._cache_lock_acquire()
try: try:
if oid in self.mq_cache: try:
return self.mq_cache[oid][0] result = self.mq_cache[oid]
except KeyError:
pass
else:
return result[0]
finally: finally:
self._cache_lock_release() self._cache_lock_release()
# history return serial, so use it # history return serial, so use it
...@@ -559,9 +563,12 @@ class Application(object): ...@@ -559,9 +563,12 @@ class Application(object):
try: try:
self._cache_lock_acquire() self._cache_lock_acquire()
try: try:
if oid in self.mq_cache: try:
neo.logging.debug('load oid %s is cached', dump(oid))
serial, data = self.mq_cache[oid] serial, data = self.mq_cache[oid]
except KeyError:
pass
else:
neo.logging.debug('load oid %s is cached', dump(oid))
return data, serial return data, serial
finally: finally:
self._cache_lock_release() self._cache_lock_release()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment