xdevplatform/twitter-ruby-ads-sdk

RateLimit errors from chunked TONUploads

Closed this issue · 0 comments

Issue Type: Bug

Description:

When the TONUpload is uploading a file greater than MIN_FILE_SIZE (i.e. when it's doing a chunked upload) it uses the "x-ton-min-chunk-size" as the chunk_size.

In my experience the value of "x-ton-min-chunk-size" returned from the API is 1MB, meaning that TONUpload will only upload 1MB chunks at a time and therefore very quickly exceeds the API rate limit, e.g. for a 100MB file it will attempt to do 100 requests and fail half-way once it's used up all entire rate limit for the account.

Expected Result:
Files greater than MIN_FILE_SIZE should upload without hitting rate limiting errors.

I guess it should actually use "x-ton-max-chunk-size" as the chunk size, but I'm not sure of the other implications this might have?

Actual Result:

TwitterAds::RateLimit

Steps to Reproduce:

TONUpload.new(client, "/path/to/big/file.csv").perform

Relates To: #123