Skip to content

Commit

Permalink
fix writing duplicate blocks in sync.getRepo
Browse files Browse the repository at this point in the history
  • Loading branch information
devinivy committed Oct 1, 2023
1 parent cef38e3 commit ec7039c
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
6 changes: 0 additions & 6 deletions packages/pds/src/sql-repo-storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
2 changes: 1 addition & 1 deletion packages/repo/src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit ec7039c

Please sign in to comment.