nasa / gesdisc-meditor

MIT License
7 stars 2 forks source link

Only clear out publication statuses that don't match the document's current state #42

Closed joncarlson closed 1 year ago

joncarlson commented 1 year ago

Background

A "Draft" document is published from mEditor. The "CMR Subscriber" picks it up and sends it on to CMR_UAT.

After sending it to CMR_UAT, the "CMR Subscriber" sends an acknowledgement back to mEditor.

Before mEditor stores this acknowledgement in the database, mEditor clears out any existing publication statuses, from the db, for the given subscriber (called "target" in the NATS messages, i.e. cmr for CMR subscriber)

The problem

If the subscriber pushes to multiple CMR providers, mEditor will only store one of the acknowledgements that comes back.

The solution

Don't clear out any publication statuses matching the same state as the document's state.

In other words, if a document is in "Published" state, clear out any publication statuses for other states (Draft, Under Review, etc.) but leave publication statuses in the "Published" state