Merge pull request #4253 from filecoin-project/fix/syncwait-applied-offset

sync wait: Handle processed message offset
This commit is contained in:
Łukasz Magiera 2020-10-08 23:30:55 +02:00 committed by GitHub
commit cd0a43b7f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -233,7 +233,13 @@ func SyncWait(ctx context.Context, napi api.FullNode) error {
samples := 8
i := 0
var app, lastApp uint64
var firstApp, app, lastApp uint64
state, err := napi.SyncState(ctx)
if err != nil {
return err
}
firstApp = state.VMApplied
for {
state, err := napi.SyncState(ctx)
@ -286,10 +292,10 @@ func SyncWait(ctx context.Context, napi api.FullNode) error {
if i%samples == 0 {
lastApp = app
app = state.VMApplied
app = state.VMApplied - firstApp
}
if i > 0 {
fmt.Printf("Validated %d messages (%d per second)\n", state.VMApplied, (app-lastApp)*uint64(time.Second/tick)/uint64(samples))
fmt.Printf("Validated %d messages (%d per second)\n", state.VMApplied-firstApp, (app-lastApp)*uint64(time.Second/tick)/uint64(samples))
lastLines++
}