fix: Prune cache at startup if needed, prevent crashes and OOMs#2139
Merged
nikclayton merged 1 commit intopachli:mainfrom Feb 24, 2026
Merged
fix: Prune cache at startup if needed, prevent crashes and OOMs#2139nikclayton merged 1 commit intopachli:mainfrom
nikclayton merged 1 commit intopachli:mainfrom
Conversation
Some devices don't run WorkManager tasks reliably. See details at https://dontkillmyapp.com/. This is a problem, as if the local database gets too large the timeline queries can take seconds to run or return too much data, leading to poor performance, OOM crashes, or others. Work around this for the moment by pruning the cache in `IntentRouterActivity`, the `MAIN` activity. The cache is pruned if there are more 800 rows in `TimelineStatusWithAccount`, a figure-in-the-air guess at how many rows is likely to indicate that the workers aren't running as expected. While I'm here, update the "Prune cache" feature in `DatabaseFragmentViewModel` to prune the log as well.
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.
Some devices don't run WorkManager tasks reliably. See details at https://dontkillmyapp.com/.
This is a problem, as if the local database gets too large the timeline queries can take seconds to run or return too much data, leading to poor performance, OOM crashes, or others.
Work around this for the moment by pruning the cache in
IntentRouterActivity, theMAINactivity.The cache is pruned if there are more 800 rows in
TimelineStatusWithAccount, a figure-in-the-air guess at how many rows is likely to indicate that the workers aren't running as expected.While I'm here, update the "Prune cache" feature in
DatabaseFragmentViewModelto prune the log as well.