picasso icon indicating copy to clipboard operation
picasso copied to clipboard

Uploaded file lifecycles

Open rhsimplex opened this issue 7 years ago • 1 comments

Uploaded pictures are dumped into a temp directory and never managed past that point. They should be cleaned up at some interval.

rhsimplex avatar Jun 07 '17 08:06 rhsimplex

Ho sophisticated do you imagine this to be?

Right now all the pointers to the path are held in memory, and if the application terminates it's wiping the memory but not the files from disk. There are two options that I can come up with from the top of my head:

  1. Have the application scan the directory and look for available files instead of holding the references in memory. Cleaning up the file system can be handled by a cronjob
  2. Same as 1) but files get deleted when maximum amount of files is reached and a new file gets uploaded (Like a FIFO buffer).
  3. Store all references in a database and handle the lifecycle completely in Picasso (e.g. with Celery/Redis)

Your description sounds more like option 3 but I am more leaning towards 2 because it doesn't require any more infrastructure and is probably the simplest to implement. Additionally, it has the least amount of surprise for the user, IMHO. It only does something when the user interacts with it and no magic in the background is cleaning up the files.

jan-xyz avatar Apr 09 '18 19:04 jan-xyz