Skip to content

Conversation

@stephanos
Copy link
Collaborator

@stephanos stephanos commented Sep 4, 2025

What was changed

Fix resume bug.

Why?

The OnComplete hook wasn't always invoked properly leading to under-counting the completed iterations.

Checklist

  1. Closes

  2. How was this tested:

  1. Any docs updates needed?

// each iteration.
UpdateWorkflowOptions func(context.Context, *Run, *KitchenSinkWorkflowOptions) error

DefaultConfiguration RunConfiguration
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Leftover from last PR where I removed it.

}

// Initial check before entering the loop.
if err := check(); err != nil {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Minor optimization to query immediately instead of waiting for first tick.

startTime := time.Now()
iterStart := time.Now()

defer func() {
Copy link
Collaborator Author

@stephanos stephanos Sep 4, 2025

Choose a reason for hiding this comment

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

Main fix: by using defer, we now guarantee it always records the completion.

go func() {
var err error
startTime := time.Now()
iterStart := time.Now()
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Address variable shadowing.

@stephanos stephanos marked this pull request as ready for review September 4, 2025 19:17
@stephanos stephanos requested a review from a team as a code owner September 4, 2025 19:17
},
}
workerDone <- runner.Run(t.Context(), baseDir)
workerDone <- runner.Run(ctx, baseDir)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Cancellation was never reaching worker ...


env := workers.SetupTestEnvironment(t,
workers.WithExecutorTimeout(2*time.Minute),
workers.WithExecutorTimeout(1*time.Minute),
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

With proper worker shutdown (see below), test is much faster now.

@stephanos stephanos merged commit 669a545 into main Sep 9, 2025
61 of 62 checks passed
@stephanos stephanos deleted the fix-resume-tps branch September 9, 2025 21:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants