Increment alarmVersion more selectively#5639
Merged
MellowYarker merged 2 commits intomainfrom Dec 4, 2025
Merged
Conversation
We missed a couple of places in the previous alarms fix commit, like deleteAll. Furthermore, we probably only want to be incrementing the alarmVersion if setAlarm() actually provided a new value, since calling setAlarm(T) when T is already the set alarm is a no-op. This could have posed a problem, namely, if I move an alarm later from T to T + 10, and I call setAlarm(T + 10) multiple times, then each time that would increment the alarmVersion, but only the first call would trigger a commitImpl. The first commit would determine that its alarmVersionBeforeAsync was less than the current alarmVersion, and would assume a subsequent commit would handle any alarms, but there wouldn't be any more commits so we would just fail to schedule the alarm with the alarm manager. Luckily, this would only affect move-later alarms, which don't have to sync with the alarm manager immediately.
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
justin-mp
approved these changes
Dec 4, 2025
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.
I tested this in our internal code base and verified that without this fix, move-later alarms do get dropped before they sync to the alarm manager if we setAlarm(sameTime) repeatedly. That's not ideal, but it's fine because we self-correct when we
armAlarmHandler(). Anyways, should be fixed now.