Repository navigation
fix(ios): regain healthy timer leeway after the fast foreground beat - #21478
Merged
Merged
Conversation
The fast foreground beat arms first=1s/repeating=4s with 50ms leeway (one leeway serves the whole DispatchSourceTimer schedule), but recorded the armed interval as 4s, so the tick handler's desired==armed check never retargeted and every later healthy beat kept the 50 ms coalescing tolerance for the rest of the session. Track the pending fast first fire explicitly, retarget to the armed cadence after it emits (deferring to the desired-cadence branch when the state changed while the beat was pending), and clear the flag on cancel. Invariant: none triggered (liveness deadlines unchanged; coalescing tolerance only).
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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.
Summary
Answers the one unresolved non-outdated thread on #21406 ("Restore healthy leeway after the fast foreground beat"):
appBecameActivearmsfirst: 1s, repeating: 4s, and aDispatchSourceTimerrecords a single leeway for the whole schedule — 50 ms for the fast first fire. BecauseprogressIntervalArmedwas recorded as 4 s, the tick handler'sdesired == armedcheck never retargeted, so every later healthy beat for the rest of the session kept the 50 ms coalescing tolerance the fast beat needed.The pending fast first fire is now tracked explicitly (
progressFastFirePending). After it emits, the timer retargets to the armed repeating cadence, regaining the 500 ms healthy leeway. If the capture state changed while the beat was pending, the retarget defers to the existing desired-cadence branch instead, preserving the fault-path behaviors pinned by the #21406 review (a preserved fast fire through recovery, a second fault before the fire).cancelProgressTimerclears the flag with the rest of the timer state.Product invariants
Failure class
Failure-Class: none
Test plan
syncProgressTimer/applyProgressCadencestate machine; flag lifecycle covers arm/retarget/cancel