Story #3226

Updated by bmbouter over 2 years ago

h2. Motivation

A RepositoryVersion that has complete=False and experiences an error will be deleted by core, then exception will be reraised, and the user will see the exception in the task failure. In the event of a crash though, we have no mechanism to clean up the incomplete RepositoryVersion. This would be an area of improvement.

h2. Design

Add an attribute to RepositoryVersion called <code>task</code> that is a: <code>ForeignKey('Task', null=True, backref='repo_version')</code>

This attribute <code>task</code>would be visible in the RepositoryVersion serializer
The backref <code>repo_version</code> attribute would *not* be visible on the Task serializer

Have "the task cleanup code": delete all of the associated publishers. That worker already holds the necessary locks to make this operation safe so it just needs to make sure to perform the deletions before deleting the corresponding ReservedResource records.