pub async fn mark_reaped(conn: &mut PgConnection, id: Uuid) -> ModelResult<bool>Expand description
Retires an upload. Idempotent, so a run retrying a failed object delete can call it again.
Re-checks the two reference tables under a row lock, and reports false if a save has come to
reference the upload since get_reapable listed it. The lock is taken in a statement of its own
because under READ COMMITTED a statement’s snapshot is fixed when it starts and Postgres
refreshes only the row an UPDATE locks, never the rows its subqueries read: a single locking
UPDATE would block on a concurrent save, unblock, and then evaluate NOT EXISTS against a
snapshot from before that save committed.