Fix set bug and use more efficient vars
Signed-off-by: Damon Kaswell <damon.kaswell1@hp.com>
This commit is contained in:
+9
-9
@@ -563,19 +563,19 @@ export class IncrementalIngestionDatabaseManager {
|
||||
const refs = entities.map(e => stringifyEntityRef(e.entity));
|
||||
|
||||
await this.client.transaction(async tx => {
|
||||
const existingRefs = new Set(
|
||||
...(
|
||||
await tx<{ ref: string }>('ingestion_mark_entities')
|
||||
.select('ref')
|
||||
.whereIn('ref', refs)
|
||||
).map(e => e.ref),
|
||||
);
|
||||
const existingRefsArray = (
|
||||
await tx<{ ref: string }>('ingestion_mark_entities')
|
||||
.select('ref')
|
||||
.whereIn('ref', refs)
|
||||
).map(e => e.ref);
|
||||
|
||||
const newRefs = refs.filter(e => !existingRefs.has(e));
|
||||
const existingRefsSet = new Set(existingRefsArray);
|
||||
|
||||
const newRefs = refs.filter(e => !existingRefsSet.has(e));
|
||||
|
||||
await tx('ingestion_mark_entities')
|
||||
.update('ingestion_mark_id', markId)
|
||||
.whereIn('ref', Array.from(existingRefs));
|
||||
.whereIn('ref', existingRefsArray);
|
||||
|
||||
await tx('ingestion_mark_entities').insert(
|
||||
newRefs.map(ref => ({
|
||||
|
||||
Reference in New Issue
Block a user