Skip to content

Commit 6bc3ceb

Browse files
committed
Removed the unnecessary batching while processing the codebase
1 parent 94d8c69 commit 6bc3ceb

File tree

2 files changed

+4
-17
lines changed

2 files changed

+4
-17
lines changed

rocket-chatter-ingestion-server/src/process/prepare/codebase.ts

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,8 @@ export class Codebase {
8989
this._batches = batches
9090
}
9191

92-
private writeNodesRangeToFile(
93-
nodes: Record<string, DBNode>,
94-
fileName: string,
95-
start: number,
96-
end: number
97-
) {
98-
const entries = Object.entries(nodes).slice(start, end)
92+
private writeNodesToFile(nodes: Record<string, DBNode>, fileName: string) {
93+
const entries = Object.entries(nodes)
9994
if (entries.length === 0) return 0
10095
const batch = Object.fromEntries(entries)
10196
writeFileSync(
@@ -127,15 +122,7 @@ export class Codebase {
127122
// }
128123

129124
/* Step 2 */
130-
for (let i = 0; i < Object.keys(nodes).length; i += this._batchSize) {
131-
const [start, end] = [i, i + this._batchSize]
132-
this.writeNodesRangeToFile(
133-
nodes,
134-
`batch-${batchNumber}.json`,
135-
start,
136-
end
137-
)
138-
}
125+
this.writeNodesToFile(nodes, `batch-${batchNumber}.json`)
139126

140127
nNodesProcessed = Object.keys(nodes).length
141128
}

rocket-chatter-ingestion-server/src/use.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Codebase } from "./process/prepare/codebase"
22
import { FileProcessor } from "./process/prepare/processor/file"
33

44
async function main() {
5-
const codebase = new Codebase("./project", new FileProcessor(), 1)
5+
const codebase = new Codebase("./project2", new FileProcessor(), 1)
66
await codebase.process()
77
// await codebase.embed()
88

0 commit comments

Comments
 (0)