[Scheduler] Skip recomputing FutureActionTimes after handling completion events#10896
Draft
lina-temporal wants to merge 1 commit into
Draft
[Scheduler] Skip recomputing FutureActionTimes after handling completion events#10896lina-temporal wants to merge 1 commit into
lina-temporal wants to merge 1 commit into
Conversation
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.
Pending a functional test to show observed visibility write count
What changed?
We skip computing
FutureActionTimesinGeneratorTaskas a result of handling completion callbacks.Why?
The completion handler runs a
GeneratorTaskto drive the idle timer, which is reset on external events (including completions). Whenever a task runs, CHASM framework callsMemoto determine if it should make a visibility upsert. Prior to the change, we'd observe aMemowrite from the completion handlerGeneratorTaskremoving an entry (becauseRemainingActionsdecrements, for example). Then, when the loopingGeneratorTaskthat drives automated actions ran, it caused an oscillation from adding another entry (because now the high water mark has advanced past the start interval).The write that merely removes an entry before the high water mark moves past the scheduled interval isn't particularly useful to anyone, so it's wasted load on visi. This change removes the potential for a completion callback to trigger a visibility memo write.
Oh, note: I did also experiment with trying to get fancy within
GeneratorTask, in deciding if it should update FutureActionTimes automatically, but I couldn't come up with a clean, pure condition that didn't also regress some weird edge case test.How did you test it?
Potential risks
FutureActionTimesfield when we expected to. However, this is mitigated given that the regularly-scheduledGeneratorTaskalways recomputes future action times, so in a scenario where I've missed a valid case for updating visi as a result of a completion, the worst case is visi updates only after the next interval elapses.