Skip to content

Commit 9324ff8

Browse files
committed
Fixed all bugs related to ingestion process
1 parent 4d535ce commit 9324ff8

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

ingestion/src/process/ingest/ingest.ts

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { readdirSync } from "fs"
22
import { readFile } from "fs/promises"
33
import path from "path"
4-
54
import { v4 as uuid } from "uuid"
5+
66
import { RC_APP_URI } from "../../constants"
77
import { DBNode, DBNodeRelation } from "../../core/dbNode"
88

@@ -112,12 +112,21 @@ export async function insertDataIntoDB(batchesDirPath: string) {
112112
if (errorBatches.size > 0) console.log("❌ Error batches", errorBatches)
113113

114114
// Establish relations
115-
const success = await Algorithms.establishRelations(relations)
116-
if (success) {
117-
console.log("🔗 Relations established")
118-
} else {
119-
console.log("❌ Error establishing relations")
115+
const batchSize = 1000
116+
for (let i = 0; i < relations.length; i += batchSize) {
117+
const success = await Algorithms.establishRelations(
118+
relations.slice(i, i + batchSize)
119+
)
120+
if (success) {
121+
console.log(`🔗 Relations established ${i + 1000}/${relations.length}`)
122+
} else {
123+
console.log(
124+
`❌ Error establishing relations ${i + 1000}/${relations.length}`
125+
)
126+
}
120127
}
128+
129+
console.log("🔗 All Relations established")
121130
}
122131

123132
console.log("✅ Inserted")

0 commit comments

Comments
 (0)