Merge pull request #15665 from dekoding/dekoding/bugfix-no-empty-entities-array

fix(incremental): do not try to commit empty array of entity records
This commit is contained in:
Fredrik Adelöw
2023-01-11 10:07:03 +01:00
committed by GitHub
2 changed files with 14 additions and 7 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog-backend-module-incremental-ingestion': patch
---
Fixed issue with sometimes trying to commit an empty array of references
@@ -577,13 +577,15 @@ export class IncrementalIngestionDatabaseManager {
.update('ingestion_mark_id', markId)
.whereIn('ref', existingRefsArray);
await tx('ingestion_mark_entities').insert(
newRefs.map(ref => ({
id: v4(),
ingestion_mark_id: markId,
ref,
})),
);
if (newRefs.length > 0) {
await tx('ingestion_mark_entities').insert(
newRefs.map(ref => ({
id: v4(),
ingestion_mark_id: markId,
ref,
})),
);
}
});
}