belaudiobooks / website

Catalog of belarusian audiobooks
GNU General Public License v3.0
32 stars 6 forks source link

Automatically remove unused images #113

Open nbeloglazov opened 8 months ago

nbeloglazov commented 8 months ago

With the addition of auto-resizing images upon uploading we now end up with hanging unused images. It happens when we remove an image from a book or person. The main image is removed while all resized are left. We can update existing function that resizes images to also cleanup unused. Or introduce entirely new function for that checks all used images (based on data from DB or data.json) and remove unused.

We can also try being extra careful and use Google Cloud Storage TTL capability (which I think exists) in order to avoid removing images immediately. And instead setting something like 30 days TTL after which they will be automatically deleted. That way, if we mess up function that cleans up images - we'll be able to undo it within 30 days.