Skip to main content

Module exercise_spec_upload_reaper

Module exercise_spec_upload_reaper 

Source
Expand description

Removes files uploaded through the exercise-service upload route that never reached a saved spec.

Nothing else can reclaim them: the host stores specs as opaque blobs, so a stored file’s only reference may sit inside content it cannot parse. What makes a file safe here is a declaration β€” exercise_task_spec_files for a live spec, page_history_spec_files for every snapshot a restore could bring back. Because history is kept, this reaper mostly collects uploads a teacher abandoned before saving, not files dropped from a spec that was once saved.

The binding row is soft-deleted rather than removed, leaving an audit trail of what was reclaimed.

ConstantsΒ§

MAX_CONCURRENT_REAPS πŸ”’

FunctionsΒ§

main
reap πŸ”’
reap_one πŸ”’
Retires the record, removes the object, and only then soft-deletes the file_uploads row. Ok(false) means a save came to declare the file after get_reapable listed it, so it is no longer reapable.