-
Notifications
You must be signed in to change notification settings - Fork 80
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
feat: support concurrent transaction handling #67
Conversation
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.
tested Ack
…to monika/concurrent-txs
parser/worker.go
Outdated
// handleMessages accepts the transaction and handles messages contained | ||
// inside the transaction. An error is returned if the message unpacking | ||
// or calling handlers fails. | ||
func (w Worker) handleMessages(tx *types.Tx) error { |
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.
I believe this method can be updated to be more similar to handleTx
. We just need to un pack the messages first
It would be something like
// inside ExportTxs
sdkMsgs := make(sdk.Msg[], len(tx.Body.Messages)
for i, stdMsg := range tx.Body.Messages {
var stdMsg sdk.Msg
err := w.codec.UnpackAny(msg, &stdMsg)
if err != nil {
return err
}
sdkMsgs[i] = sdkMsg
}
for i, sdkMsg := range sdkMsgs {
go w.handleMessage(i, sdkMsg, tx)
}
And then the handleMessage
would be
func (w Woker) handleMessage(index int, tx *types.Tx, msg sdk.Msg) {
for _, module := range w.modules {
if messageModule, ok := module.(modules.MessageModule); ok {
err = messageModule.HandleMsg(i, stdMsg, tx)
if err != nil {
w.logger.MsgError(module, tx, stdMsg, err)
}
}
}
}
Hey @RiccardoM thanks for that, I updated the code now 👍🏻 Can you review it again pls? thx |
Can someone test this code before finally approving it? Maybe @huichiaotsou |
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.
Code looks good, we just need to test this to make sure it works properly
## Description Fixes #64 ## Checklist - [x] Targeted PR against correct branch. - [x] Linked to Github issue with discussion and accepted design OR link to spec that describes this work. - [ ] Wrote unit tests. - [x] Re-reviewed `Files changed` in the Github PR explorer.
Description
Fixes #64
Checklist
Files changed
in the Github PR explorer.