Task #3184

Updated by almost 3 years ago

The current implementation of the publishing task starts an outer transaction. This is undesirable because:
* Long running transactions can accumulate DB locks which can result in contention.
* Could exceed DB limitations on rollback segement.
* Prevents progress reports from being committed.

with transaction.atomic():
needs to be removed.

Without the outer transaction, each plugin will need to periodically commit for performance reasons (we don't want 5k commits).

Without the outer transaction, the publication will be committed _half-baked_. There needs to be a way to prevent the publication from being used before it is completely constructed. Suggestions have been made to add like a _visible_ attribute that is False during publishing and set True on success. At the beginning of each task, any previous publications created by the (same) publisher that are still marked _visible=False_ _visible_False_ would deleted to clean things up. Any code that uses publications would need to be updated to only use _visible=True_ publications. This includes association to Distributions.