Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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: pass FinalizeBlock request and response to ABCIListener #18486
fix: pass FinalizeBlock request and response to ABCIListener #18486
Changes from all commits
2eb307f
fccfed1
9f820c4
9ba0740
caa228b
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
The added code block correctly implements the logic to call
ListenFinalizeBlock
on eachABCIListener
registered with thestreamingManager
. However, there are a few considerations to ensure robustness:Error Handling: The error from
ListenFinalizeBlock
is logged but not handled beyond that. If the error indicates a critical failure that should prevent the block from finalizing, this should be considered. If the listeners are not critical to block finalization, the current approach is acceptable.Context Cancellation: The context passed to
ListenFinalizeBlock
is thefinalizeBlockState.ctx
. Ensure that this context is appropriate for the listeners and consider if a separate context with a timeout should be used for each listener to prevent one listener from blocking others in case it hangs or takes too long.Logging: The error logging is good, but it might be beneficial to also log successful calls to
ListenFinalizeBlock
for debugging and monitoring purposes.Performance: If there are many listeners and
ListenFinalizeBlock
is not a lightweight operation, this could introduce a performance bottleneck. Consider if these calls should be made concurrently.Resilience: If one listener fails, the loop continues to the next. This is typically desired behavior, but ensure that this aligns with the application's fault tolerance requirements.
State Mutation: If
ListenFinalizeBlock
mutates shared state, ensure that it's safe from race conditions.Here's a suggestion to log successful listener invocations and to consider the use of goroutines for concurrent execution if appropriate:
And if concurrency is deemed necessary:
Note that if you choose to execute the listeners concurrently, you must ensure that any shared state accessed by
ListenFinalizeBlock
is thread-safe.