Download thread error handling
This commit is contained in:
parent
75a6f605c1
commit
4b40d4bce1
|
@ -47,11 +47,17 @@ class DownloadThread(threading.Thread, StoppableThread):
|
||||||
timedOut = now - DownloadThread.requestTimeout
|
timedOut = now - DownloadThread.requestTimeout
|
||||||
# this may take a while, but it needs a consistency so I think it's better to lock a bigger chunk
|
# this may take a while, but it needs a consistency so I think it's better to lock a bigger chunk
|
||||||
with i.objectsNewToMeLock:
|
with i.objectsNewToMeLock:
|
||||||
|
try:
|
||||||
downloadPending = len(list((k for k, v in i.objectsNewToMe.iteritems() if k in missingObjects and missingObjects[k] > timedOut)))
|
downloadPending = len(list((k for k, v in i.objectsNewToMe.iteritems() if k in missingObjects and missingObjects[k] > timedOut)))
|
||||||
|
except KeyError:
|
||||||
|
continue
|
||||||
if downloadPending >= DownloadThread.minPending:
|
if downloadPending >= DownloadThread.minPending:
|
||||||
continue
|
continue
|
||||||
# keys with True values in the dict
|
# keys with True values in the dict
|
||||||
|
try:
|
||||||
request = list((k for k, v in i.objectsNewToMe.iteritems() if k not in missingObjects or missingObjects[k] < timedOut))
|
request = list((k for k, v in i.objectsNewToMe.iteritems() if k not in missingObjects or missingObjects[k] < timedOut))
|
||||||
|
except KeyError:
|
||||||
|
continue
|
||||||
random.shuffle(request)
|
random.shuffle(request)
|
||||||
if not request:
|
if not request:
|
||||||
continue
|
continue
|
||||||
|
|
Reference in New Issue
Block a user