Skip to content

Commit

Permalink
sync wait: Handle processed message offset
Browse files Browse the repository at this point in the history
  • Loading branch information
magik6k committed Oct 8, 2020
1 parent e4d2e6e commit 7113153
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions cli/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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++
}

Expand Down

0 comments on commit 7113153

Please sign in to comment.