Skip to content

feat: support concurrent chunk uploads#64

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

feat: support concurrent chunk uploads#64
TorstenDittmann merged 2 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 rewrites the chunked upload path in Client.swift to support concurrent chunk uploads using Swift's withThrowingTaskGroup, replacing the previous sequential while loop. A sliding-window scheduler dispatches up to Client.maxConcurrentUploads (now a configurable static property, defaulting to 8) chunks at a time.

  • The first chunk is always uploaded serially to obtain the server-assigned file ID before concurrent tasks are dispatched — correct for Appwrite's resumable upload protocol.
  • Resumable uploads are handled: an existing file check sets offset and result = map before the task group runs, fixing a latent crash where a fully-pre-uploaded file would have called converter!([String:Any]()).
  • completedResponse ?? lastChunkResponse ?? result provides a fallback chain so the function always returns the most complete response available.

Confidence Score: 4/5

The concurrent upload rewrite is structurally sound with no data-loss paths; the main gap is that onProgress is never fired when resuming an already-complete file.

The sliding-window task group and first-chunk serialisation are implemented correctly. The addition of result = map fixes a latent crash for pre-completed files. The one unresolved behavioural gap is that onProgress is never fired when the upload resumes into an already-complete state, which could leave callers silently waiting.

Sources/Appwrite/Client.swift — the post-task-group onProgress gap and uploadedBytes initialisation clarity in the first-chunk block.

Important Files Changed

Filename Overview
Sources/Appwrite/Client.swift Chunked upload rewritten to use concurrent task group with sliding-window dispatch; first chunk serialised for ID acquisition; resumable-upload path correctly seeds result from existence check; maxConcurrentUploads exposed as configurable static.

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

Comment thread Sources/Appwrite/Client.swift
Comment thread Sources/Appwrite/Client.swift Outdated
Comment thread Sources/Appwrite/Client.swift Outdated
@TorstenDittmann TorstenDittmann merged commit 40836a2 into main May 21, 2026
1 check passed
@TorstenDittmann TorstenDittmann deleted the concurrent-chunk-uploads-1-9-x-minimal branch May 21, 2026 17:55
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