File tree Expand file tree Collapse file tree 1 file changed +15
-6
lines changed
ingestion/src/process/ingest Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Original file line number Diff line number Diff line change 11import { readdirSync } from "fs"
22import { readFile } from "fs/promises"
33import path from "path"
4-
54import { v4 as uuid } from "uuid"
5+
66import { RC_APP_URI } from "../../constants"
77import { 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" )
You can’t perform that action at this time.
0 commit comments