config: Add a new option connect_timeout
connect_timeout can be used to increase the time Spack waits for the server to answer. This can be used to work around slow connections or servers. Fixes #14700
This commit is contained in:

committed by
Peter Scheibel

parent
ffb9591dc9
commit
7325c20794
@@ -97,6 +97,7 @@
|
||||
config_defaults = {
|
||||
'config': {
|
||||
'debug': False,
|
||||
'connect_timeout': 10,
|
||||
'verify_ssl': True,
|
||||
'checksum': True,
|
||||
'dirty': False,
|
||||
|
@@ -326,11 +326,15 @@ def _fetch_from_url(self, url):
|
||||
'-D',
|
||||
'-', # print out HTML headers
|
||||
'-L', # resolve 3xx redirects
|
||||
# Timeout if can't establish a connection after 10 sec.
|
||||
'--connect-timeout', '10',
|
||||
url,
|
||||
]
|
||||
|
||||
connect_timeout = spack.config.get('config:connect_timeout')
|
||||
|
||||
if connect_timeout > 0:
|
||||
# Timeout if can't establish a connection after n sec.
|
||||
curl_args.extend(['--connect-timeout', str(connect_timeout)])
|
||||
|
||||
if not spack.config.get('config:verify_ssl'):
|
||||
curl_args.append('-k')
|
||||
|
||||
|
@@ -55,6 +55,7 @@
|
||||
},
|
||||
'source_cache': {'type': 'string'},
|
||||
'misc_cache': {'type': 'string'},
|
||||
'connect_timeout': {'type': 'integer', 'minimum': 0},
|
||||
'verify_ssl': {'type': 'boolean'},
|
||||
'suppress_gpg_warnings': {'type': 'boolean'},
|
||||
'install_missing_compilers': {'type': 'boolean'},
|
||||
|
Reference in New Issue
Block a user