AppView in a box as a Vite plugin thing hatk.dev
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

perf: free CAR bytes and block map early during backfill

Reduces memory pressure by releasing intermediate data before bulk insert.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

+4 -2
+4 -2
packages/hatk/src/backfill.ts
··· 181 181 throw httpErr 182 182 } 183 183 184 - const carBytes = new Uint8Array(await res.arrayBuffer()) 184 + let carBytes: Uint8Array | null = new Uint8Array(await res.arrayBuffer()) 185 185 carSizeBytes = carBytes.length 186 - const { roots, blocks } = parseCarFrame(carBytes) 186 + let { roots, blocks }: { roots: string[]; blocks: Map<string, Uint8Array> | null } = parseCarFrame(carBytes) 187 + carBytes = null // free CAR bytes before bulk insert 187 188 188 189 // Decode commit to get MST root 189 190 const rootData = blocks.get(roots[0]) ··· 217 218 }) 218 219 } 219 220 } 221 + blocks = null // free block map before bulk insert 220 222 221 223 // Delete existing records for this DID before re-importing so deletions are reflected 222 224 for (const col of collections) {