edgi-govdata-archiving / web-monitoring-db

An HTTP API for tracking and annotating changes to a set of web pages.
https://api.monitoring.envirodatagov.org/
GNU General Public License v3.0
17 stars 26 forks source link

An import that fails between creating a page and creating a version leaves an empty page record #192

Open Mr0grog opened 6 years ago

Mr0grog commented 6 years ago

If an import results in the creation of a new page record, but fails when creating the actual version of that page (because of invalid data), the empty page record gets left lying around afterward. While we think it’s OK for the DB to have pages with no versions, it’s not really desirable, and we shouldn’t wind up in that situation accidentally like this.

The import versions job needs to be careful to roll back the creation of a page if the version failed.

I can think of a couple straightforward ways of doing this:

We also need a test for this.

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in seven days if no further activity occurs. If it should not be closed, please comment! Thank you for your contributions.

Mr0grog commented 5 years ago

~This is actually a reasonably serious issue we need to fix.~

Mr0grog commented 5 years ago

Update: this issue is not so serious now that @bensheldon fixed edgi-govdata-archiving/web-monitoring-ui#363.