Task #3184

Updated by bmbouter 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.

The following line needs to be removed:

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. Here is Suggestions have been made to add like a recap of a list design discussion:

* Add an
_visible_ attribute called 'complete' that is False during publishing and set True on success. Historically, the term _visible_ as strong ties to Publication which defaults to False.
* Update
user interfaces. I propose the viewset so more appropriate boolean field name _valid_ be used. At the beginning of each task, any previous publications created by the (same) publisher that it excludes Publications that have complete=False
* Update the filterset for Publications
are still marked _valid=False_ would deleted to also exclude Publications clean things up. Any code that have complete=False
* After the plugin code returns control
uses publications would need to core, have core set complete=True on the Publication and then call save() just before exiting. be updated to only use _valid=True_ publications. This includes association to Distributions.