Merge pull request #1381 from filecoin-project/feat/stats-nosync

stats: add flag to disable sync wait
This commit is contained in:
Łukasz Magiera 2020-03-10 07:12:52 +01:00 committed by GitHub
commit eeca91e43d

View File

@ -22,6 +22,7 @@ func main() {
var repo string = "~/.lotus" var repo string = "~/.lotus"
var database string = "lotus" var database string = "lotus"
var reset bool = false var reset bool = false
var nosync bool = false
var height int64 = 0 var height int64 = 0
var headlag int = 3 var headlag int = 3
@ -30,6 +31,7 @@ func main() {
flag.Int64Var(&height, "height", height, "block height to start syncing from (0 will resume)") flag.Int64Var(&height, "height", height, "block height to start syncing from (0 will resume)")
flag.IntVar(&headlag, "head-lag", headlag, "number of head events to hold to protect against small reorgs") flag.IntVar(&headlag, "head-lag", headlag, "number of head events to hold to protect against small reorgs")
flag.BoolVar(&reset, "reset", reset, "truncate database before starting stats gathering") flag.BoolVar(&reset, "reset", reset, "truncate database before starting stats gathering")
flag.BoolVar(&nosync, "nosync", nosync, "skip waiting for sync")
flag.Parse() flag.Parse()
@ -65,8 +67,10 @@ func main() {
} }
defer closer() defer closer()
if err := WaitForSyncComplete(ctx, api); err != nil { if !nosync {
log.Fatal(err) if err := WaitForSyncComplete(ctx, api); err != nil {
log.Fatal(err)
}
} }
tipsetsCh, err := GetTips(ctx, api, abi.ChainEpoch(height), headlag) tipsetsCh, err := GetTips(ctx, api, abi.ChainEpoch(height), headlag)