TS/runtime-5: align virtual/real time in all types of scheduled task category#10305
Open
feiyang3cat wants to merge 1 commit into
Open
TS/runtime-5: align virtual/real time in all types of scheduled task category#10305feiyang3cat wants to merge 1 commit into
feiyang3cat wants to merge 1 commit into
Conversation
3d50bdf to
a3f1761
Compare
4ab596d to
cca239e
Compare
8c53840 to
d848ebf
Compare
feiyang3cat
commented
May 18, 2026
| // the overall solution is to attempt to generate a new activity timer task whenever the | ||
| // task passed in is safe to be throw away. | ||
| referenceTime := t.Now() | ||
| actionFn := func(ctx context.Context, wfContext historyi.WorkflowContext, mutableState historyi.MutableState, _ historyi.ReleaseWorkflowContextFunc) (any, error) { |
Contributor
Author
There was a problem hiding this comment.
needs a bit attention
for all executions (the majority won't have timeskipping), the reference time is still delayed to when actionFn runs, and this may be a few us/ms delay depending on the cache miss/hit. right now I judge it as safe and no correctness risks
there is another way to do this is to change the referenceTime only when the mutableState has TimeSkippingInfo set, and I am not taking this path now for simplicity
feiyang3cat
commented
May 18, 2026
| // real wall-clock, so convert here — callers outside MutableState don't see the virtual | ||
| // vs. real distinction. The CategoryTypeScheduled drop-check above runs first so it | ||
| // compares virtual-vs-virtual (now is also virtual). | ||
| if skip > 0 && category == tasks.CategoryTimer { |
Contributor
Author
There was a problem hiding this comment.
though we add other scheduled timer task types in, the executors of archival and speculative tasks don't validate the fire time, so for those tasks the executor files are untouched
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed?
uses ms.Now() (virtual) instead of wall.
ToRealTime(heartbeatTimeoutVis) (was mixed frames), and use ms.Now instead of t.Now for activity timeout/user timer time check
Now, SetSpeculativeWorkflowTaskTimeoutTask.
Why?
Under time skipping, virtual time inside mutable state can run ahead of wall time, but scheduled-task
firing still runs on wall time. Each crossing needs explicit conversion:
Before this change, virtual and wall values were silently compared — harmless pre-skipping, but now lets
the wrong tasks get dropped/kept and stale heartbeat tasks pass dedup.
How did you test it?