-
Notifications
You must be signed in to change notification settings - Fork 16
add simple linear retries to Numia APRs query #683
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: v28.x
Are you sure you want to change the base?
Conversation
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. WalkthroughAdds retry logic to the Numia APR fetcher with configurable retry count and delay. Errors are logged per attempt, with sleep between retries. On success, results are returned immediately; on exhaustion, an error is returned and a counter is incremented. Introduces new constants and imports for fmt and time. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant C as Caller
participant F as NumiaAPRFetcher
participant N as Numia API
C->>F: GetPoolAPRs()
rect rgba(200,230,255,0.3)
note over F: Retry loop (i = 1..N)
F->>N: Fetch APRs
alt Success
N-->>F: APR data
F-->>C: Map of APRs (return)
else Failure
N-->>F: Error
F->>F: Log attempt error
opt More retries remaining
F->>F: Sleep (retry delay)
end
end
end
alt All retries failed
F->>F: Increment error counter
F-->>C: Error (retries exhausted)
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used🧬 Code graph analysis (1)sqsutil/datafetchers/numia_apr_fetcher.go (3)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
🔇 Additional comments (3)
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 |
logger.Error("Failed to fetch pool APRs,", zap.Error(err), zap.Int("retry", i)) | ||
|
||
time.Sleep(numiaAPRsFetchRetryDelay) | ||
continue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
Add retries and only alert after 3 failed attempts to reduce the alert noise
Summary by CodeRabbit