Skip to content

feat: support concurrent chunk uploads#96

Merged
TorstenDittmann merged 4 commits into
mainfrom
concurrent-chunk-uploads-1-9-x-minimal
May 21, 2026
Merged

feat: support concurrent chunk uploads#96
TorstenDittmann merged 4 commits into
mainfrom
concurrent-chunk-uploads-1-9-x-minimal

Conversation

@TorstenDittmann

Copy link
Copy Markdown
Contributor

This PR updates the SDK to support concurrent chunk uploads.

@greptile-apps

greptile-apps Bot commented May 21, 2026

Copy link
Copy Markdown

Greptile Summary

This PR replaces the sequential chunk-upload loop with a concurrent implementation that uploads the first chunk alone (to obtain the server-assigned upload ID), then dispatches all remaining chunks with up to 8 parallel requests using a fill-the-pipeline queue. The version is bumped to 13.1.0 and the response-format header is updated to 1.9.5.

  • The rejected flag correctly short-circuits new chunk dispatch and suppresses onProgress callbacks after any chunk fails, and finalResponse ?? lastResponse provides the return-value fallback for the completed upload.
  • ping()'s return type is widened to Promise<unknown>, which is a TypeScript-breaking change for SDK consumers that previously used the result as a string.
  • totalChunks === 1 (line 1003) is dead code because the file.size <= Client.CHUNK_SIZE early return on line 977 always fires first for single-chunk files.

Confidence Score: 4/5

The concurrent upload logic is sound and the rejected flag properly gates new dispatch after failure. The only concern is a TypeScript API surface change on ping() that could break typed call sites.

The concurrent upload implementation is correct: the first-chunk gate, x-appwrite-id propagation, byte-range arithmetic, and the rejected-flag guard all look right. The ping() return-type change from string to unknown is a breaking TypeScript API change that could require consumer-side fixes.

src/client.ts — the ping() return type change and the dead totalChunks === 1 branch.

Important Files Changed

Filename Overview
src/client.ts Rewrites chunked upload to support up to 8 concurrent chunk requests; uploads first chunk sequentially to obtain the upload ID, then dispatches remaining chunks concurrently with a rejected flag to stop dispatch after failure. The ping() return type is widened from Promise<string> to Promise<unknown>.
package.json Version bump 13.0.0 → 13.1.0 and response-format header updated to 1.9.5.
package-lock.json Lock file updated to reflect the version bump to 13.1.0; no dependency changes.

Reviews (4): Last reviewed commit: "feat: support concurrent chunk uploads" | Re-trigger Greptile

Comment thread src/client.ts Outdated
Comment thread src/client.ts
Comment thread src/client.ts Outdated
Comment thread src/client.ts
@TorstenDittmann TorstenDittmann merged commit af44e6d into main May 21, 2026
1 check passed
@TorstenDittmann TorstenDittmann deleted the concurrent-chunk-uploads-1-9-x-minimal branch May 21, 2026 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants