From 44fea6871a8fac8bc76c7a41cd569dca764b7664 Mon Sep 17 00:00:00 2001 From: Fabio Erculiani Date: Sun, 26 Jun 2011 12:18:58 +0200 Subject: [PATCH] [entropy.client.interfaces.db] to avoid socket timeouts, make sure to flush all the parallel downloads before starting another chunk --- libraries/entropy/client/interfaces/db.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libraries/entropy/client/interfaces/db.py b/libraries/entropy/client/interfaces/db.py index a91305cf8..946286167 100644 --- a/libraries/entropy/client/interfaces/db.py +++ b/libraries/entropy/client/interfaces/db.py @@ -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,