Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FR]: Set chunk size on upload task #10137

Closed
cclaan opened this issue Aug 25, 2022 · 4 comments · Fixed by #10609
Closed

[FR]: Set chunk size on upload task #10137

cclaan opened this issue Aug 25, 2022 · 4 comments · Fixed by #10609

Comments

@cclaan
Copy link

cclaan commented Aug 25, 2022

Description

I may be missing something very obvious, but I see no way to set the upload chunk size from swift code for a 'FIRStorageUploadTask' created via FIRStorageReference putFile.
e.g.

let uploadTask = remoteRef.putFile(from: fileURL, metadata: metadata)
  1. Use case: allow custom chunk sizes so resumable uploads work by default
  2. Currently the chunk size seems hard coded to a large value
  3. I propose allowing custom chunk sizes

In FIRStorageUploadTask.m the chunk size seems to be set from the constant kGTMSessionUploadFetcherStandardChunkSize which is set to LLONG_MAX;

    GTMSessionUploadFetcher *uploadFetcher =
        [GTMSessionUploadFetcher uploadFetcherWithRequest:request
                                           uploadMIMEType:strongSelf->_uploadMetadata.contentType
                                                chunkSize:kGTMSessionUploadFetcherStandardChunkSize
                                           fetcherService:self.fetcherService];

Perhaps there is a way to modify this somewhere, but I can't find any documentation on it.

Thanks for any support.

API Proposal

let uploadTask = remoteRef.putFile(from: fileURL, metadata: metadata, chunkSize: myChunkSize )

Firebase Product(s)

Storage

@google-oss-bot
Copy link

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@paulb777
Copy link
Member

@cclaan Thank for the feature request. You're correct that there's currently no way to change chunkSize from LLONG_MAX

We've begun work on a Swift-only V2 API for Storage in #10161. chunkSize could work well as a default argument in the new API.

@paulb777 paulb777 removed this from the Firebase 10 - M122 milestone Sep 16, 2022
@paulb777
Copy link
Member

@cclaan Would you provide more description about the value of being able to set the chunkSize. Why do you want to be able to manage the upload in smaller chunks?

@cclaan
Copy link
Author

cclaan commented Dec 17, 2022

My use case is uploading ~20mb files from a phone with potentially poor network connection. Using smaller chunks is required so that the upload does not restart from scratch every time the network drops. ( Previously chunkSize was LLONG_MAX )

@firebase firebase locked and limited conversation to collaborators Feb 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.