-
Notifications
You must be signed in to change notification settings - Fork 193
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
chore: close iterator in IterateEpochInfo #2172
Conversation
📝 WalkthroughWalkthroughThe pull request introduces a minor maintenance update to the Nibiru EVM's epoch management code. The change focuses on adding a deferred iterator closure in the Changes
Poem
✨ Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
x/epochs/keeper/epoch.go (1)
69-69
: Consider handling the Close() error.While the current implementation is correct, it might be worth considering handling any potential errors from the Close() operation.
Here's a suggestion to handle the Close() error:
- defer iterate.Close() + defer func() { + if err := iterate.Close(); err != nil { + // Log the error or wrap it into a multi-error if the function + // signature is updated to return error + k.Logger(ctx).Error("failed to close epoch iterator", "error", err) + } + }()
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
CHANGELOG.md
(1 hunks)x/epochs/keeper/epoch.go
(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- CHANGELOG.md
🔇 Additional comments (1)
x/epochs/keeper/epoch.go (1)
69-69
: LGTM! Good catch on adding the iterator cleanup.The addition of
defer iterate.Close()
is a good practice for proper resource management, ensuring the iterator is closed after use.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2172 +/- ##
==========================================
+ Coverage 64.86% 64.89% +0.02%
==========================================
Files 277 277
Lines 22283 22302 +19
==========================================
+ Hits 14454 14472 +18
Misses 6839 6839
- Partials 990 991 +1
|
Purpose / Abstract
Based on L-01 | Unclosed Iterator in IterateEpochInfo