chore(feed): cap exponential backoff#3357
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Central YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (1)
📝 WalkthroughSummary by CodeRabbit
WalkthroughModified the retry/backoff logic in ChangesRetry Backoff Schedule
Estimated code review effort: 2 (Simple) | ~10 minutes Related PRs: None found. Suggested labels: None Suggested reviewers: None 🐰 A rabbit hops with steady pace, 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| url := fmt.Sprintf("https://nvd.nist.gov/feeds/json/cve/2.0/nvdcve-2.0-%d.json.gz", year) | ||
|
|
||
| const maxRetries = 10 | ||
| const maxBackoff = 5 * time.Minute |
There was a problem hiding this comment.
Given how sensitive NVD's availability is to request rates, and since they've explicitly acknowledged performance issues in the past, do you think it would make sense to back off for longer periods of time?
backoffs := []time.Duration{
15 * time.Second,
30 * time.Second,
1 * time.Minute,
2 * time.Minute,
4 * time.Minute,
5 * time.Minute, // max backoff
}Then:
backoff := backoffs[min(attempt-1, len(backoffs)-1)]For a short, fixed retry policy like this, I think the explicit table is easier to reason about than encoding the same behavior indirectly through arithmetic and a cap.
|
@dcaravel: The following tests failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
The backoff introduced is a bit 'too exponential' when retries were increased, this change caps backoff to 5 mins
ex: