Skip to content

Commit

Permalink
tests: Ensure node is synced before doing further queries
Browse files Browse the repository at this point in the history
  • Loading branch information
kostko committed Feb 21, 2023
1 parent 2bbc7d9 commit a5ea3e5
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions go/oasis-node/cmd/debug/txsource/workload/queries.go
Original file line number Diff line number Diff line change
Expand Up @@ -872,6 +872,14 @@ func (q *queries) Run(
for {
loopCtx, cancel := context.WithTimeout(ctx, queriesIterationTimeout)

// Ensure the node appears synced before doing queries. Given that nodes can be killed and
// held stopped for a while, they need to sync once they come back.
if isSynced, _ := q.control.IsSynced(loopCtx); !isSynced {
_ = q.control.WaitSync(loopCtx)
time.Sleep(1 * time.Second)
continue
}

err := q.doQueries(loopCtx, rng)
cancel()
switch {
Expand Down

0 comments on commit a5ea3e5

Please sign in to comment.