Small optimisation to CacheListDescriptor

This commit is contained in:
Erik Johnston 2016-06-02 11:52:32 +01:00
parent 597013caa5
commit e043ede4a2
3 changed files with 21 additions and 14 deletions

View file

@ -311,12 +311,12 @@ class CacheListDescriptor(object):
try:
res = cache.get(tuple(key))
if not res.called:
if not res.has_succeeded():
res = res.observe()
res.addCallback(lambda r, arg: (arg, r), arg)
cached_defers[arg] = res
else:
results[arg] = res.result
results[arg] = res.get_result()
except KeyError:
missing.append(arg)