[OE-core] [PATCH 2/2] bitbake: fetch2/wget: checkstatus: use the same arguments as parent
Nicola Lunghi
nick83ola at gmail.com
Thu Dec 19 14:53:23 UTC 2019
the commit:
312f1a5e741: bitbake: fetchption: attempt checkstatus again if it fails
was introducing an extra parameter to the checkstatus function, overriding
the parent.
Avoid that and remove recursion as is not needed.
Also introduce a small delay between the two requests.
Signed-off-by: Nicola Lunghi <nick83ola at gmail.com>
---
bitbake/lib/bb/fetch2/wget.py | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/bitbake/lib/bb/fetch2/wget.py b/bitbake/lib/bb/fetch2/wget.py
index 180fe9aacd..9c0defb6d2 100644
--- a/bitbake/lib/bb/fetch2/wget.py
+++ b/bitbake/lib/bb/fetch2/wget.py
@@ -201,7 +201,7 @@ class Wget(FetchMethod):
return True
- def checkstatus(self, fetch, ud, d, try_again=True):
+ def checkstatus(self, fetch, ud, d):
class HTTPConnectionCache(http.client.HTTPConnection):
if fetch.connection_cache:
def connect(self):
@@ -404,10 +404,21 @@ class Wget(FetchMethod):
pass
return True
except urllib.error.URLError as e:
- logger.debug(2, "checkstatus() urlopen failed: %s" % e)
- if try_again:
- logger.debug(2, "checkstatus: trying again")
- return self.checkstatus(fetch, ud, d, False)
+ logger.debug(2, "checkstatus() urlopen failed: %s", e)
+
+ # Some services such as SourceForge seem to struggle to keep up under
+ # load, with the result that over half of the autobuilder checkuri
+ # runs fail with sourceforge.net "connection timed out". Attempt to
+ # mitigate this by re-attempting once the network operation on failure.
+ import time
+ time.sleep(0.2)
+ logger.debug(2, "checkstatus: trying again")
+ try:
+ with opener.open(r) as response:
+ pass
+ return True
+ except urllib.error.URLError as e:
+ logger.debug(2, "checkstatus() urlopen failed for the second time: %s", e)
return False
def _parse_path(self, regex, s):
--
2.20.1
More information about the Openembedded-core
mailing list