aboutsummaryrefslogtreecommitdiffstats
path: root/python/fatcat_tools
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2019-05-22 16:20:09 -0700
committerBryan Newbold <bnewbold@robocracy.org>2019-05-22 16:20:09 -0700
commitb081f2af2c3f808a4b7f0672351c12428c83ce9e (patch)
tree6a18748a8b80a06b2fcc74da019de3eabe458380 /python/fatcat_tools
parent5af153683cdd9b883bc142a4bd7bb447612d494a (diff)
downloadfatcat-b081f2af2c3f808a4b7f0672351c12428c83ce9e.tar.gz
fatcat-b081f2af2c3f808a4b7f0672351c12428c83ce9e.zip
pubmed: try to work around multi-edits
Diffstat (limited to 'python/fatcat_tools')
-rw-r--r--python/fatcat_tools/importers/pubmed.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/python/fatcat_tools/importers/pubmed.py b/python/fatcat_tools/importers/pubmed.py
index e5d413a7..923c5492 100644
--- a/python/fatcat_tools/importers/pubmed.py
+++ b/python/fatcat_tools/importers/pubmed.py
@@ -739,9 +739,19 @@ class PubmedImporter(EntityImporter):
existing.ext_ids.pmcid = existing.ext_ids.pmcid or re.ext_ids.pmcid
existing.refs = existing.refs or re.refs
existing.extra['pubmed'] = re.extra['pubmed']
- self.api.update_release(self.get_editgroup_id(), existing.ident, existing)
- self.counts['update'] += 1
- return False
+ try:
+ self.api.update_release(self.get_editgroup_id(), existing.ident, existing)
+ self.counts['update'] += 1
+ except fatcat_client.rest.ApiException as err:
+ # there is a code path where we try to update the same release
+ # twice in a row; if that happens, just skip
+ # NOTE: API behavior might change in the future?
+ if "release_edit_editgroup_id_ident_id_key" in err.body:
+ self.counts['skip-update-conflict'] += 1
+ else:
+ raise err
+ finally:
+ return False
return True