-
Notifications
You must be signed in to change notification settings - Fork 70
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
fix(local pub sub): fix must subscribe to handle context cancelled #1002
Conversation
WalkthroughThe recent changes enhance the clarity and maintainability of the codebase by streamlining method names related to block cache management. Key methods have been renamed for brevity, ensuring consistency across the code. Additionally, error handling in the subscription logic has been refined to improve robustness. Overall, these modifications maintain existing functionality while making the code easier to read and work with. Changes
Sequence Diagram(s)sequenceDiagram
participant Manager
participant BlockCache
participant Event
Manager->>BlockCache: Get(blockHeight)
alt Block exists
BlockCache-->>Manager: Return cachedBlock
Manager->>Manager: Process cachedBlock
else Block does not exist
BlockCache-->>Manager: Block not found
end
Manager->>Event: Subscribe()
alt Subscription error
Event-->>Manager: Return error
end
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 as PR comments)
Additionally, you can add 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
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (6)
- block/block.go (2 hunks)
- block/block_cache.go (1 hunks)
- block/p2p.go (2 hunks)
- block/retriever.go (1 hunks)
- block/submit.go (2 hunks)
- utils/event/funcs.go (1 hunks)
Files skipped from review due to trivial changes (3)
- block/block_cache.go
- block/p2p.go
- block/submit.go
Additional comments not posted (3)
utils/event/funcs.go (1)
27-33
: Improved error handling inMustSubscribe
.The changes enhance robustness by wrapping errors for context and handling context cancellation gracefully, avoiding unnecessary panics.
block/retriever.go (1)
139-139
: Streamlined cache management inProcessNextDABatch
.Replacing
DeleteBlockFromCache
withDelete
suggests a more unified approach to cache management, enhancing maintainability.block/block.go (1)
Line range hint
124-140
:
Refactored cache management inattemptApplyCachedBlocks
.The transition to using
Get
andDelete
methods reflects a consistent and streamlined cache management interface, improving code clarity.
PR Standards
Opening a pull request should be able to meet the following requirements
--
PR naming convention: https://hackmd.io/@nZpxHZ0CT7O5ngTp0TP9mg/HJP_jrm7A
Close #XXX
<-- Briefly describe the content of this pull request -->
For Author:
godoc
commentsFor Reviewer:
After reviewer approval:
Summary by CodeRabbit
New Features
Bug Fixes
Refactor