Skip to content

Commit 1cdadad

Browse files
committed
feat: batch proofItems
1 parent 626b01a commit 1cdadad

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

archivist.nim.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@
44
--define:"chronicles_sinks=textlines[dynamic],json[dynamic],textlines[dynamic]"
55
# enable metrics collection
66
--define:metrics
7+
# bypass Nim TLSF allocator to avoid cross-thread free accumulation
8+
--define:useMalloc

archivist/node.nim

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,8 +544,13 @@ proc store*(
544544
var proofItems: seq[(Natural, Cid, ArchivistProof)]
545545
for index, cid in cids:
546546
proofItems.add((index.Natural, cid, ?tree.getProof(index)))
547+
if proofItems.len >= storeBatchSize:
548+
?await self.repoStore.putCidsAndProofs(tmpCid, proofItems)
549+
proofItems.setLen(0)
547550

548-
?await self.repoStore.putCidsAndProofs(tmpCid, proofItems)
551+
if proofItems.len > 0:
552+
?await self.repoStore.putCidsAndProofs(tmpCid, proofItems)
553+
proofItems.setLen(0)
549554

550555
success treeCid
551556
)

0 commit comments

Comments
 (0)