Add FileStore.purge_tmp() method
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
FileStore |
Fix Released
|
High
|
Jason Gerard DeRose |
Bug Description
To add a file to a FileStore, it's first copied to a temporary location in .dmedia/tmp/. After the content-hash is computed, the file is moved to its canonical location in .dmedia/files/.
Because os.rename() is atomic on POSIX systems, files are always in a well-defined state as either being temporary or being stored, with no fuzzy middle area. Because of this, we're treating anything in .dmedia/tmp/ as fair game for deletion.
There are a number of ways in which you might get stale temporary files: you abort an import, an error occurs during an import, a render fails, etc. So it's a good idea for us to periodically purge stale temporary files so they don't build up over time. Dmedia will do this when a FileStore is first connected.
Related branches
- James Raymond: Approve
-
Diff: 159 lines (+106/-1)3 files modifieddoc/filestore.rst (+12/-1)
filestore.py (+22/-0)
test_filestore.py (+72/-0)
Changed in filestore: | |
status: | In Progress → Fix Committed |
Changed in filestore: | |
status: | Fix Committed → Fix Released |