Skip to content

Commit

Permalink
fix(nvd-mirror): use an exponential backoff for retrying pages (#2526)
Browse files Browse the repository at this point in the history
The NVD API is frequently flaky, and an exponential backoff will give
slightly more time for things to recover before any individual page
fails permanently, which causes the entire mirroring run to abort.
  • Loading branch information
andrewpollock authored Aug 26, 2024
1 parent 52024ed commit b28bae1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion vulnfeeds/cmd/download-cves/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func downloadCVE2WithOffset(APIKey string, offset int) (page *cves.CVEAPIJSON20S
if APIKey != "" {
req.Header.Add("apiKey", APIKey)
}
backoff := retry.NewConstant(6 * time.Second)
backoff := retry.NewExponential(6 * time.Second)
if err := retry.Do(context.Background(), retry.WithMaxRetries(3, backoff), func(ctx context.Context) error {
resp, err := client.Do(req)
if err != nil {
Expand Down

0 comments on commit b28bae1

Please sign in to comment.