Commit 07e11994 authored by Julien Muchembled's avatar Julien Muchembled

storage: small optimisation of askObject for most likely code path

parent 84f9894e
...@@ -45,16 +45,12 @@ class ClientOperationHandler(EventHandler): ...@@ -45,16 +45,12 @@ class ClientOperationHandler(EventHandler):
app.queueEvent(self.askObject, conn, (oid, serial, tid)) app.queueEvent(self.askObject, conn, (oid, serial, tid))
return return
o = app.dm.getObject(oid, serial, tid) o = app.dm.getObject(oid, serial, tid)
if o is None: try:
logging.debug('oid = %s does not exist', dump(oid))
p = Errors.OidDoesNotExist(dump(oid))
elif o is False:
logging.debug('oid = %s not found', dump(oid))
p = Errors.OidNotFound(dump(oid))
else:
serial, next_serial, compression, checksum, data, data_serial = o serial, next_serial, compression, checksum, data, data_serial = o
logging.debug('oid = %s, serial = %s, next_serial = %s', except TypeError:
dump(oid), dump(serial), dump(next_serial)) p = (Errors.OidDoesNotExist if o is None else
Errors.OidNotFound)(dump(oid))
else:
if checksum is None: if checksum is None:
checksum = ZERO_HASH checksum = ZERO_HASH
data = '' data = ''
......
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