Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: Multiple txsource fixes #5192

Merged
merged 2 commits into from
Feb 21, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added .changelog/5192.trivial.md
Empty file.
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a good practice to always cancel context.
We are stealing time from query timeout when syncing, not sure if a problem.
If the node never syncs, we never gracefully exit the loop.
I think one line could be removed.

if err = q.control.WaitSync(loopCtx); err != nil {
	time.Sleep(time.Second)
	continue
}
``

}

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