Cache API should prune empty directories when closing

NEW
Unassigned

Status

()

3 years ago
3 years ago

People

(Reporter: bkelly, Unassigned)

Tracking

(Blocks: 1 bug)

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

3 years ago
Looking at my current Cache profile dir for trained-to-thrill, I see that there are a large number of empty directories in the morgue.  This is because trained-to-thrill removes old Responses when it updates with new flikr images.  When a Response is removed, we currently just leave the intermediate morgue directory even if its now empty.

This is not a real problem, but it does use a small amount of disk space and pessimizes the disk lookup since there are more directory entries to traverse.

We should consider removing empty directories when the Cache is closed for an origin.  The easiest place do this would be during the database connection close where we currently run the incremental vacuum:

  https://dxr.mozilla.org/mozilla-central/source/dom/cache/Connection.cpp?from=dom%2Fcache%2FConnection.cpp&offset=0#44

Its not really a database operation, but its the best "on close" hook we have at the moment.
You need to log in before you can comment on or make changes to this bug.