feat(synapse-sdk): batch storage uploads by default - #935
Open
hugomrdias wants to merge 2 commits into
Open
Conversation
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
synapse-dev | c71be31 | Commit Preview URL Branch Preview URL |
Aug 26 2026, 12:14 PM |
6 tasks
hugomrdias
requested review from
a team,
BigLep,
jennijuju and
rjan90
as code owners
August 26, 2026 12:01
hugomrdias
requested review from
BravoNatalie
and removed request for
a team,
BigLep,
jennijuju and
rjan90
August 26, 2026 12:13
BravoNatalie
approved these changes
Aug 26, 2026
BravoNatalie
left a comment
There was a problem hiding this comment.
Things look good to me! The only thing my agent found was some testing hardening, which I left as a comment.
| ) | ||
| }) | ||
|
|
||
| it('should reject concurrent uploads cleanly when shared batch entry creation fails', async () => { |
There was a problem hiding this comment.
Before the fix, both promises were already rejecting with expected. The issue was the extra unhandled rejection from void existing.then(...).
Could we also check that no unhandledrejection happens? Maybe with a Node subprocess using --unhandled-rejections=strict? Since Chromium only logs page errors without failing the test, I think reverting the fix could still leave this test green.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
addPieceswork while respecting transaction message-size limitsStorageManager.upload()andStorageContext.upload()Synapse, plussynapse.storage.flush()for explicitly releasing limiter-held batchespieceBatching: falseUsage
Batching is enabled by default, using a zero-delay window:
The delay can be configured when creating the client:
The limiter strategy holds a batch until it reaches the transaction size boundary or the application flushes it:
To retain the previous immediate, per-upload behavior:
How it works
StorageManager.upload()resolves the primary and secondary contexts exactly as before, including the default request for at least two copies.addPiecesmessage-size limit.The existing result and failure semantics remain intact: successful copies are returned in
copies, intermediate provider failures remain infailedAttempts, and the manager still throwsStoreErrororCommitErrorwhen the corresponding operation cannot succeed.The split
store(),pull(), andcommit()APIs remain unchanged and unbatched.flush()waits for uploads and pulls to finish parking before releasing all current windows; the core batcher'sclose()prevents new work and delegates to that same flush behavior.Compatibility
pieceBatching: falsePdpDataSetcontract remains unchangedTests
packages/synapse-corebuildpackages/synapse-sdkbuild