-
Notifications
You must be signed in to change notification settings - Fork 4.2k
fix: pass FinalizeBlock request and response to ABCIListener #18486
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
Changes from all commits
2eb307f
fccfed1
9f820c4
9ba0740
caa228b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -891,6 +891,14 @@ func (app *BaseApp) FinalizeBlock(req *abci.RequestFinalizeBlock) (*abci.Respons | |
| if res != nil { | ||
| res.AppHash = app.workingHash() | ||
| } | ||
|
|
||
| // call the streaming service hooks with the FinalizeBlock messages | ||
| for _, streamingListener := range app.streamingManager.ABCIListeners { | ||
| if err := streamingListener.ListenFinalizeBlock(app.finalizeBlockState.ctx, *req, *res); err != nil { | ||
| app.logger.Error("ListenFinalizeBlock listening hook failed", "height", req.Height, "err", err) | ||
| } | ||
| } | ||
|
|
||
| return res, err | ||
| } | ||
|
Comment on lines
891
to
903
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The added code block correctly implements the logic to call
Here's a suggestion to log successful listener invocations and to consider the use of goroutines for concurrent execution if appropriate: // call the streaming service hooks with the FinalizeBlock messages
for _, streamingListener := range app.streamingManager.ABCIListeners {
if err := streamingListener.ListenFinalizeBlock(app.finalizeBlockState.ctx, *req, *res); err != nil {
app.logger.Error("ListenFinalizeBlock listening hook failed", "height", req.Height, "err", err)
} else {
+ app.logger.Info("ListenFinalizeBlock listening hook succeeded", "height", req.Height)
+ }
}And if concurrency is deemed necessary: var wg sync.WaitGroup
for _, streamingListener := range app.streamingManager.ABCIListeners {
wg.Add(1)
go func(listener ABCIListener) {
defer wg.Done()
if err := listener.ListenFinalizeBlock(app.finalizeBlockState.ctx, *req, *res); err != nil {
app.logger.Error("ListenFinalizeBlock listening hook failed", "height", req.Height, "err", err)
} else {
app.logger.Info("ListenFinalizeBlock listening hook succeeded", "height", req.Height)
}
}(streamingListener)
}
wg.Wait()Note that if you choose to execute the listeners concurrently, you must ensure that any shared state accessed by |
||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.