From ba7b351ad57314d01059783ef30f82d8303a84ea Mon Sep 17 00:00:00 2001 From: devin ivy Date: Sun, 1 Oct 2023 15:09:34 -0400 Subject: [PATCH] Fix writing duplicate blocks in sync.getRepo (#1699) fix writing duplicate blocks in sync.getRepo --- packages/pds/src/sql-repo-storage.ts | 6 ------ packages/repo/src/util.ts | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/packages/pds/src/sql-repo-storage.ts b/packages/pds/src/sql-repo-storage.ts index 7522e325bfa..13301ae300f 100644 --- a/packages/pds/src/sql-repo-storage.ts +++ b/packages/pds/src/sql-repo-storage.ts @@ -229,12 +229,6 @@ export class SqlRepoStorage extends ReadableBlockstore implements RepoStorage { const res = await this.getBlockRange(since, cursor) await writePromise writePromise = writeRows(res) - for (const row of res) { - await car.put({ - cid: CID.parse(row.cid), - bytes: row.content, - }) - } const lastRow = res.at(-1) if (lastRow && lastRow.repoRev) { cursor = { diff --git a/packages/repo/src/util.ts b/packages/repo/src/util.ts index 563a848d4ae..89f85a097d5 100644 --- a/packages/repo/src/util.ts +++ b/packages/repo/src/util.ts @@ -95,7 +95,7 @@ export const readCar = async ( const roots = await car.getRoots() const blocks = new BlockMap() for await (const block of verifyIncomingCarBlocks(car.blocks())) { - await blocks.set(block.cid, block.bytes) + blocks.set(block.cid, block.bytes) } return { roots,