PhoenixKit.Modules.Storage.Jobs.PurgeLibrary (phoenix_kit v2.52.2)

Copy Markdown View Source

Purges one trashed storage library (storage.purge_library): its files (bytes included, through the normal delete path), its folders, then the library (PhoenixKit.Modules.Storage.Libraries.purge_library/1) — as a job run, so an admin can see that it is happening and what became of it.

Visible, not controllable (controls/0 is []; plan 2026-10-03-job-runs.md, R6). Libraries.purge_library/1 walks the whole library in one go, deletion cannot be undone, and the purging marker deliberately refuses a restore — so Pause and Cancel would promise what the work cannot do. Batching the purge, and what cancelling one means, is its own piece of work.

A library on a user's own bucket whose objects could not all be deleted is retried ({:error, :objects_remain}, five attempts), then fails visibly; the daily trash prune starts it again. A library that is gone, or no longer trashed, ends the run with nothing done. Started by Storage.Workers.PurgeLibraryJob, the Oban job the user-deletion and the prune have always queued (it commits with their transaction).