More fixes in objects to be downloaded

This commit is contained in:
Peter Šurda 2017-01-15 23:07:11 +01:00
parent bd1aead46e
commit 12205ee7ba
Signed by untrusted user: PeterSurda
GPG Key ID: 0C5F50C0B5F37D87
1 changed files with 16 additions and 17 deletions

View File

@ -121,7 +121,6 @@ class Missing(object):
def pull(self, count=1):
if count < 1:
raise ValueError("Must be at least one")
with self.lock:
objectHashes = []
try:
for objectHash in self.hashes.keys():
@ -134,7 +133,7 @@ class Missing(object):
self.removeObjectFromCurrentThread(objectHash)
if len(objectHashes) >= count:
break
except RuntimeError:
except (RuntimeError, KeyError, ValueError):
# the for cycle sometimes breaks if you remove elements
pass
return objectHashes