aboutsummaryrefslogtreecommitdiffstats
path: root/rust/src
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2020-01-15 15:33:22 -0800
committerBryan Newbold <bnewbold@robocracy.org>2020-01-15 15:33:24 -0800
commit96df40583576d6a00dd585628bb9569996d038b5 (patch)
tree485d74126148c747d9685ff12c76c5f289f6dea0 /rust/src
parent689da76d1c759d6368d760b4a1fa942e16095a40 (diff)
downloadfatcat-96df40583576d6a00dd585628bb9569996d038b5.tar.gz
fatcat-96df40583576d6a00dd585628bb9569996d038b5.zip
fatcatd: fix corner-case in abstracts insertion
Both the release_abstract relation table and the abstracts table inserts were being gated by a check on new abstracts table rows. I *think* the chance of this having caused problems is low. The most likely would have been updates to exiting entities that somehow removed the abstracts content, but not the sha1 keys. This is not the default behavior of the API: either the entire abstract (content and hash) is returned, or the abstracts are hidden entirely (via `hide` flag). Still, best to be careful!
Diffstat (limited to 'rust/src')
-rw-r--r--rust/src/entity_crud.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/rust/src/entity_crud.rs b/rust/src/entity_crud.rs
index c0c9e30b..83dd26c9 100644
--- a/rust/src/entity_crud.rs
+++ b/rust/src/entity_crud.rs
@@ -2395,7 +2395,8 @@ impl EntityCrud for ReleaseEntity {
.execute(conn)?;
}
- // limit is much smaller for abstracts, so don't need to batch
+ // abstracts-per-release limit is much smaller for abstracts (won't ever hit 65k row
+ // limit), so don't need to chunk these inserts
if !abstract_rows.is_empty() {
// Sort of an "upsert"; only inserts new abstract rows if they don't already exist
insert_into(abstracts::table)
@@ -2403,6 +2404,8 @@ impl EntityCrud for ReleaseEntity {
.on_conflict(abstracts::sha1)
.do_nothing()
.execute(conn)?;
+ }
+ if !release_abstract_rows.is_empty() {
insert_into(release_rev_abstract::table)
.values(release_abstract_rows)
.execute(conn)?;