fix(chainwatch): Parallel reward persistence; Tighten rpc logging

This commit is contained in:
Mike Greenberg 2020-07-16 22:57:51 -04:00
parent 6e7f21de03
commit 18d1ab0cb9
2 changed files with 19 additions and 7 deletions

View File

@ -5,6 +5,7 @@ import (
"context"
"time"
"golang.org/x/sync/errgroup"
"golang.org/x/xerrors"
"github.com/filecoin-project/lotus/build"
@ -131,15 +132,23 @@ func (p *Processor) persistRewardActors(ctx context.Context, rewards []rewardAct
log.Debugw("Persisted Reward Actors", "duration", time.Since(start).String())
}()
if err := p.storeChainPower(rewards); err != nil {
return err
}
grp, ctx := errgroup.WithContext(ctx)
if err := p.storeBaseBlockReward(rewards); err != nil {
return err
}
grp.Go(func() error {
if err := p.storeChainPower(rewards); err != nil {
return err
}
return nil
})
return nil
grp.Go(func() error {
if err := p.storeBaseBlockReward(rewards); err != nil {
return err
}
return nil
})
return grp.Wait()
}
func (p *Processor) storeChainPower(rewards []rewardActorInfo) error {

View File

@ -29,6 +29,9 @@ var runCmd = &cli.Command{
if err := logging.SetLogLevel("*", ll); err != nil {
return err
}
if err := logging.SetLogLevel("rpc", "error"); err != nil {
return err
}
api, closer, err := lcli.GetFullNodeAPI(cctx)
if err != nil {