Skip to content

Time skip to StickyWorkerUnavailable #9287

Draft
stephanos wants to merge 1 commit intotemporalio:mainfrom
stephanos:advance-time-matching
Draft

Time skip to StickyWorkerUnavailable #9287
stephanos wants to merge 1 commit intotemporalio:mainfrom
stephanos:advance-time-matching

Conversation

@stephanos
Copy link
Contributor

@stephanos stephanos commented Feb 11, 2026

What changed?

  1. Replaced (most) use of time package in Matching with virtual systemClock.
  2. Added separate taskClock to Matching to be able to force StickyWorkerUnavailable to trigger asap.
  3. Replaced time.Sleep(10*time.Second) in TestWorkflowUpdateSuite with time skipping.

Note that (1) can also be a separate PR; if that helps.

Why?

Test runtime before: 10.21s
Test runtime after: 1.3s

There's some extra overhead for starting the cluster; but as we can see here, it's a worthwhile tradeoff.

How did you test it?

  • built
  • run locally and tested manually
  • covered by existing tests
  • added new unit test(s)
  • added new functional test(s)

Potential risks

  1. taskClock isn't used everywhere it could yet. This might cause confusion since certain things you might expect to be time-skippable won't work. But you have to start somewhere; blocking this effort on identifying every single location first will be difficult.

  2. Advancing taskClock in tests requires a dedicated cluster. This makes its use expensive. Either we accept that it's a rare use case; or if not, could consider a namespace-aware timesource (provider).

@stephanos stephanos force-pushed the advance-time-matching branch 9 times, most recently from 5ec25dc to 1a70768 Compare February 11, 2026 02:52
s.NoError(err)

s.Logger.Info("Sleep 10+ seconds to make sure stickyPollerUnavailableWindow time has passed.")
time.Sleep(10*time.Second + 100*time.Millisecond) //nolint:forbidigo
Copy link
Contributor Author

@stephanos stephanos Feb 11, 2026

Choose a reason for hiding this comment

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

So funny thing; this doesn't even work. The 10s are being waited on for nothing as the sticky task queue is never actually created since there's never a poller.

@stephanos stephanos force-pushed the advance-time-matching branch 8 times, most recently from 4d5a512 to 99a3741 Compare February 11, 2026 03:52
@stephanos stephanos force-pushed the advance-time-matching branch from 99a3741 to 56d4f09 Compare February 11, 2026 05:20
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.

1 participant