Scratch space is another capacity boundary
Media inspection, archive creation or interrupted downloads may leave partial files behind. If every worker writes to one small temporary volume, a few abandoned files can prevent all later delivery. The application needs a lifecycle for these local artifacts.
What to do next
- 01
Allocate scoped temporary paths
Create per-operation scratch directories under an intended application workspace, using generated names rather than user-provided paths. Track their owner and creation time so cleanup can identify abandoned work without touching unrelated files.
- 02
Bound usage during writes
Enforce per-file and total scratch limits while streaming, not only after completion. Reserve capacity or apply backpressure before admitting more heavy work, and handle write failures as delivery problems with the original completed task preserved.
- 03
Clean with lifecycle evidence
Remove temporary files in normal cleanup and run an age-based sweeper for abandoned operations, checking that no active lease still owns them. Test process interruption and disk-full behavior with synthetic media.
A concrete example
Illustrative example: an archive job stops halfway and leaves a partial bundle. A sweeper later removes its expired, unowned scratch directory. The completed source assets remain available, and no regeneration is triggered by the local disk failure.
Before you call it ready
- Scratch paths stay in the intended root.
- Writes enforce size bounds.
- Cleanup preserves active operations and source assets.
When to stop or choose another method
Stop attributing every save failure to provider quotas before checking the application's own scratch volume and abandoned-file lifecycle.
