Handle exception in iterator
This commit is contained in:
parent
805f72e098
commit
b750e67bfb
|
@ -123,12 +123,16 @@ class Missing(object):
|
||||||
with self.lock:
|
with self.lock:
|
||||||
since = time.time() - 60 # once every minute
|
since = time.time() - 60 # once every minute
|
||||||
objectHashes = []
|
objectHashes = []
|
||||||
|
try:
|
||||||
for objectHash in self.hashes.keys():
|
for objectHash in self.hashes.keys():
|
||||||
if current_thread().peer in self.hashes[objectHash]['peers'] and self.hashes[objectHash]['requested'] < since:
|
if current_thread().peer in self.hashes[objectHash]['peers'] and self.hashes[objectHash]['requested'] < since:
|
||||||
objectHashes.append(objectHash)
|
objectHashes.append(objectHash)
|
||||||
self.removeObjectFromCurrentThread(objectHash)
|
self.removeObjectFromCurrentThread(objectHash)
|
||||||
if len(objectHashes) >= count:
|
if len(objectHashes) >= count:
|
||||||
break
|
break
|
||||||
|
except RuntimeError:
|
||||||
|
# the for cycle sometimes breaks if you remove elements
|
||||||
|
pass
|
||||||
return objectHashes
|
return objectHashes
|
||||||
|
|
||||||
def delete(self, objectHash):
|
def delete(self, objectHash):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user