Skip to content

Skip time in UpdateWorkflowSuite [WiP]#9145

Closed
stephanos wants to merge 1 commit intotemporalio:mainfrom
stephanos:manual-faults3
Closed

Skip time in UpdateWorkflowSuite [WiP]#9145
stephanos wants to merge 1 commit intotemporalio:mainfrom
stephanos:manual-faults3

Conversation

@stephanos
Copy link
Copy Markdown
Contributor

@stephanos stephanos commented Jan 27, 2026

What changed?

Replaced all "real time" time package uses with clock.TimeSource across History and Matching.

Why?

To replace time.Sleeps with s.Advance in UpdateWorkflowSuite to skip time; one for History, one for Matching.

Before: TBD
After: TBD

How did you test it?

Tests were run 10x locally without issues.

Potential risks

Any change is risky. Identify all risks you are aware of. If none, remove this section.

@stephanos stephanos changed the title Time skip in func test [WiP] Skip time in func tests [WiP] Jan 27, 2026
@stephanos stephanos force-pushed the manual-faults3 branch 3 times, most recently from 12c3393 to d58fd6d Compare January 27, 2026 04:14
@stephanos stephanos changed the title Skip time in func tests [WiP] Skip time in UpdateWorkflowSuite [WiP] Jan 27, 2026
@stephanos stephanos force-pushed the manual-faults3 branch 5 times, most recently from 8b69955 to 59d2130 Compare January 27, 2026 04:38

// All grpc handlers should be cancelled now. Give them a little time to return.
t := time.AfterFunc(2*time.Second, func() {
t := s.timeSource.AfterFunc(2*time.Second, func() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This sort of thing is my concern with this idea: I would argue this one really should be 2 seconds of wall-clock time and not virtual time. It's in shutdown so doesn't really matter, but maybe others do and it's hard to audit them all (but we can try?)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I was just curious to see what happens if I try :)

batch := partitions[i:min(len(partitions), i+batchSize)]
wait := backoff.Jitter(delay, 0.1)
time.AfterFunc(wait, func() {
e.timeSource.AfterFunc(wait, func() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This one also (arguably) requires real time.. virtual time isn't threaded through membership, so ringpop propagation delays will not respect virtual time. Afaik we don't have any functional tests that exercise this functionality though.

In principle we could thread fake time into ringpop, it does support one (different interface though, we'd need an adapter)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That's interesting about ringpop support a fake time. But generally yes, this shouldn't be converted. My instructions were to replace everything because I preferred converting too many instead of too few to verify my test case.

@stephanos stephanos closed this Feb 11, 2026
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.

2 participants