We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
For most of the handle functions, we follow the following pattern : modules/staking/handle_genesis.go
err = saveParams(doc.InitialHeight, genState.Params, db) if err != nil { return fmt.Errorf("error while storing staking genesis params: %s", err) } // Parse genesis transactions err = parseGenesisTransactions(doc, appState, cdc, db) if err != nil { return fmt.Errorf("error while storing genesis transactions: %s", err) } ...
However, In modules/staking/handle_block.go, the pattern is different from other that use "go" concurrency instead of catching error one by one:
go updateParams(block.Block.Height, stakingClient, db) // Update the voting powers go updateValidatorVotingPower(block.Block.Height, vals, db) // Update the validators statuses go updateValidatorsStatus(block.Block.Height, validators, cdc, db)
The functions calling log later on if there are errors :
err = db.SaveStakingParams(types.NewStakingParams(res.Params, height)) if err != nil { log.Error().Str("module", "staking").Err(err). Int64("height", height). Msg("error while saving params") return }
All calls keep running even if one of the call return errors, which the old one returns when one of the calls gives out an error.
Error handling might be weird. Need to call log every time for error handling. That might reduce efficiency and harder to read code.
Implement a concurrency wrapper function for Handle that can do concurrency and also catching errors.
Do not need to do anything and stay on the current approach.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Description
For most of the handle functions, we follow the following pattern :
modules/staking/handle_genesis.go
However, In modules/staking/handle_block.go, the pattern is different from other that use "go" concurrency instead of catching error one by one:
The functions calling log later on if there are errors :
Pros
All calls keep running even if one of the call return errors, which the old one returns when one of the calls gives out an error.
Cons
Error handling might be weird. Need to call log every time for error handling. That might reduce efficiency and harder to read code.
Implementation proposal
Concurrency
Implement a concurrency wrapper function for Handle that can do concurrency and also catching errors.
Stay on the current approach
Do not need to do anything and stay on the current approach.
The text was updated successfully, but these errors were encountered: