From: Michael Tremer Date: Wed, 7 Dec 2016 00:14:54 +0000 (+0100) Subject: http: Pick mirror when downloading X-Git-Tag: 0.9.28~1285^2~1397 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b121c4da7952a63f6ec7417bac3bbbf720c38270;p=pakfire.git http: Pick mirror when downloading This avoids some unnecessary work when mirrors are added (because mirror lists can be large) and unnecessary log messages. Signed-off-by: Michael Tremer --- diff --git a/src/pakfire/http.py b/src/pakfire/http.py index dd34285a8..00ede38c1 100644 --- a/src/pakfire/http.py +++ b/src/pakfire/http.py @@ -105,9 +105,6 @@ class Client(object): self._mirrors.append(m) self._mirrors.sort() - # (Re-)select the best/first mirror - self._next_mirror() - @property def mirror(self): """ @@ -283,6 +280,10 @@ class Client(object): if message is None: message = os.path.basename(url) + # Initialize mirrors if not done, yet + if self.mirrors and not self.mirror: + self._next_mirror() + try: while True: with self._make_progressbar(message) as p: