fix(crash-log): trimOldLogs wiped all logs instead of keeping the newest#7
Merged
Conversation
trimOldLogs captured files.size once outside the loop and never updated the condition, so once >=10 logs existed every new crash erased ALL of them rather than keeping the newest 9. Extract logsToTrim() (now unit-tested) and delete only the oldest surplus files.
- SettingsActivity used remember { CoroutineScope(Dispatchers.Main) } whose
coroutines outlived the Activity; switch to rememberCoroutineScope()
(cancelled on leaving composition).
- Local import used fixed names local_import.zip / local_import_dir in the
cache dir; concurrent/double imports overwrote each other. Use
File.createTempFile and a UUID-suffixed temp dir.
- lerp now clamps t to [0,1] defensively (its callers currently only pass 0/1 but the smoothing path could overshoot by epsilon). - selectRandomLayout used biased System.nanoTime() % size; switch to Random.nextInt.
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.
No description provided.