Fix orphan blob accumulation on firmware upgrade #1601
+38
−1
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.
Fixes #1519
Related: #1495
What's this about?
PR #1495 fixed the blob leak going forward, but devices upgrading from older firmware (like v1.11.0) still have thousands of orphan blobs sitting in
/bl/eating up storage space.This adds a one-time cleanup that runs on first boot after upgrade - it just walks through
/bl/, checks each blob against the contacts list, and deletes any that don't belong to an actual contact. A marker file prevents it from running again.Only affects ESP32 and RP2040 (the platforms that use the
/bl/directory).This code can probably be removed after a few releases once most users have upgraded past this version.
Note
I also experimented with an LRU approach that caps blob count and evicts oldest files periodically - works well as an ongoing safety net, but this simpler approach should be enough for the upgrade cleanup.
Testing