Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
workspaces
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ssa
workspaces
Merge requests
!1066
Retry the validation as well as the fetch
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Retry the validation as well as the fetch
product-fetcher-retry-file-validation
into
main
Overview
0
Commits
2
Pipelines
2
Changes
3
Merged
Daniel Lyons
requested to merge
product-fetcher-retry-file-validation
into
main
2 years ago
Overview
0
Commits
2
Pipelines
2
Changes
3
Expand
0
0
Merge request reports
Viewing commit
d283a581
Prev
Next
Show latest version
3 files
+
63
−
13
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
3
Search (e.g. *.vue) (Ctrl+P)
d283a581
Retry the validation as well as the fetch
· d283a581
Daniel Lyons
authored
2 years ago
apps/cli/executables/pexable/productfetcher/productfetcher/fetchers.py
+
3
−
12
Options
@@ -41,6 +41,7 @@ from .exceptions import (
)
from
.interfaces
import
FetchProgressReporter
,
FileFetcher
,
LocatedFile
from
.locations
import
NgasFile
,
OracleXml
from
.retry
import
retry
# pylint: disable=E0401, E0402, W0221
@@ -245,18 +246,8 @@ class RetryableFileFetcher(FileFetcherDecorator):
super
().
__init__
(
underlying
)
self
.
retries
=
retries
def
do_fetch
(
self
,
attempt
=
1
)
->
Path
:
try
:
return
self
.
underlying
.
do_fetch
()
except
RetryableFetchError
as
r_err
:
if
attempt
<
self
.
retries
:
# sleep for 2, 4, 8 seconds between attempts
time
.
sleep
(
2
**
attempt
)
return
self
.
do_fetch
(
attempt
+
1
)
else
:
# let's annotate the error with how many times we tried
r_err
.
retries
=
attempt
raise
r_err
def
do_fetch
(
self
)
->
Path
:
return
retry
(
self
.
underlying
.
do_fetch
,
[
2
**
attempt
for
attempt
in
range
(
1
,
4
)])
def
__str__
(
self
):
return
f
"
{
self
.
underlying
}
(with up to
{
self
.
retries
}
retries)
"
Loading