mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-30 10:47:19 +02:00
Merge branch 'fix/gitlab_404_local_mirror_v4.2' into 'release/v4.2'
Handle gitlab 404 error (v4.2) See merge request espressif/esp-idf!16960
This commit is contained in:
@ -28,9 +28,16 @@ def retry(func): # type: (TR) -> TR
|
|||||||
try:
|
try:
|
||||||
res = func(self, *args, **kwargs)
|
res = func(self, *args, **kwargs)
|
||||||
except (IOError, EOFError, gitlab.exceptions.GitlabError) as e:
|
except (IOError, EOFError, gitlab.exceptions.GitlabError) as e:
|
||||||
if isinstance(e, gitlab.exceptions.GitlabError) and e.response_code != 500:
|
if isinstance(e, gitlab.exceptions.GitlabError):
|
||||||
# Only retry on error 500
|
if e.response_code == 500:
|
||||||
raise e
|
# retry on this error
|
||||||
|
pass
|
||||||
|
elif e.response_code == 404 and os.environ.get('LOCAL_GITLAB_HTTPS_HOST', None):
|
||||||
|
# remove the environment variable "LOCAL_GITLAB_HTTPS_HOST" and retry
|
||||||
|
os.environ.pop('LOCAL_GITLAB_HTTPS_HOST', None)
|
||||||
|
else:
|
||||||
|
# other GitlabErrors aren't retried
|
||||||
|
raise e
|
||||||
retried += 1
|
retried += 1
|
||||||
if retried > self.DOWNLOAD_ERROR_MAX_RETRIES:
|
if retried > self.DOWNLOAD_ERROR_MAX_RETRIES:
|
||||||
raise e # get out of the loop
|
raise e # get out of the loop
|
||||||
|
Reference in New Issue
Block a user