Repository navigation
Conversation
17 of 20 tasks
[Medium impact] This PR appears safe to merge. SummaryThis PR removes old alert-trigger keys from
The previous unnumbered finding is fixed: changing Reviews (3) · Last reviewed commit: "fix(notify): keep two recent days of ale..." · Reviewed by Greptile |
0xbrayo
force-pushed
the
fix/notify-prune-stale-prefs
branch
from
October 8, 2026 19:37
66cc587 to
392a14c
Compare
Member
Author
NotifyWorker wrote a triggered_<category>_<hash>_<date> key per alert per logical day and never removed any, so the preferences file grew every day and SharedPreferences loads it whole on each access. Only the current day's keys are read, so remove the rest before checking.
Pruning everything but the current logical day could re-fire alerts: moving startOfDay later (04:00 -> 06:00) before the new boundary moves the logical day back to yesterday, whose keys had just been deleted. Keep keys for the current day and the two before it.
0xbrayo
force-pushed
the
fix/notify-prune-stale-prefs
branch
from
October 19, 2026 17:18
143cfaa to
4972dfa
Compare
Member
Author
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.
Part of #333.
NotifyWorkerremembers which thresholds already fired with atriggered_<category>_<configHash>_<logicalDate>key per alert per day. Keys from earlier days were never removed, soaw_notify_prefskept growing, by one key per alert per day plus one for every reconfiguration. SharedPreferences parses the whole file into memory on first access and rewrites all of it on eachapply(), so that cost grows with every day the app is installed.Change
Testing
NotifyWorkerTestcases: keys outside the window are dropped (including thenull/"All" category), recent days and unrelated or unparseable keys are kept, and yesterday's keys survive when the logical day moves back../gradlew :mobile:testStandardDebugUnitTestpasses.