Skip to content

Commit d60a631

Browse files
committed
Revert "Release chunk buffer regardless of submit outcome"
This reverts commit 4e9b6a8.
1 parent 4e9b6a8 commit d60a631

1 file changed

Lines changed: 20 additions & 28 deletions

File tree

packages/cli/src/bulletin/store.ts

Lines changed: 20 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -788,34 +788,26 @@ export async function storeChunkedFileToBulletin(
788788
submitChunk: async (chunk) => {
789789
const nonce = waveNonces.get(chunk.index)!;
790790

791-
try {
792-
await storeContentOnBulletin({
793-
rpc: parameters.rpc,
794-
signer: parameters.signer,
795-
contentBytes: chunk.bytes,
796-
contentCid: chunk.cid,
797-
codecValue: CODEC.RAW,
798-
hashCodeValue: HASH.SHA2_256,
799-
nonce,
800-
client: activeClient,
801-
waitForFinalization,
802-
});
803-
804-
manifestState.completedBlocks.set(chunk.index, {
805-
index: chunk.index,
806-
cid: chunk.cid,
807-
length: chunk.length,
808-
});
809-
810-
completedChunks += 1;
811-
parameters.onProgress?.(chunk.index + 1, totalChunks, "stored");
812-
} finally {
813-
// Release the chunk's 2 MiB Buffer regardless of outcome. On
814-
// success it is already persisted; on failure it must not pin
815-
// memory while the caller decides whether to retry — the
816-
// payload is re-streamed from disk on the next attempt.
817-
chunk.bytes = null as unknown as Uint8Array;
818-
}
791+
await storeContentOnBulletin({
792+
rpc: parameters.rpc,
793+
signer: parameters.signer,
794+
contentBytes: chunk.bytes,
795+
contentCid: chunk.cid,
796+
codecValue: CODEC.RAW,
797+
hashCodeValue: HASH.SHA2_256,
798+
nonce,
799+
client: activeClient,
800+
waitForFinalization,
801+
});
802+
803+
manifestState.completedBlocks.set(chunk.index, {
804+
index: chunk.index,
805+
cid: chunk.cid,
806+
length: chunk.length,
807+
});
808+
809+
completedChunks += 1;
810+
parameters.onProgress?.(chunk.index + 1, totalChunks, "stored");
819811
},
820812
});
821813

0 commit comments

Comments
 (0)