[entropy.client.interfaces.db] to avoid socket timeouts, make sure to flush all the parallel downloads before starting another chunk

This commit is contained in:
Fabio Erculiani
2011-06-26 12:18:58 +02:00
parent 583316487e
commit 44fea6871a

View File

@@ -1524,6 +1524,15 @@ class AvailablePackagesRepositoryUpdater(object):
header = "\t", back = True, count = (count, maxcount,)
)
fetch_sts_map['sem'].acquire()
if len(threads) >= max_threads:
const_debug_write(__name__,
purple("joining all the parallel threads"))
# give them the chance to complete
# since long delays on socket could cause timeouts
for th in threads:
th.join()
const_debug_write(__name__, purple("parallel threads joined"))
del threads[:]
if fetch_sts_map['error']:
return None
th = ParallelTask(_do_fetch, fetch_sts_map, segment, count,