Closed mcpengelly closed 4 years ago
Thank you for the PR. I will take a look tomorrow evening or saturday morning worst case :) sorry for the delays.
No worries at all @roopakv I expect you're busy! I just like to keep PRs as an ongoing process so you (or anyone) can leave feedback whenever they have a chance. If it seems like i'm impatient thats not the case!
thank you for the PR!
thoughts
LGTM otherwise
love the auto chunking and spreading over time. in the future we could make that number customizeable instead of 10000 so that people can tune as needed
I like this. A default value that is the bare minimum would work and open up more flexibility if the users the google app is somehow able to get more then 500-600 requests per minute (ie if theyre a google partner)
lets use lodash.chunk
sounds good
should be good now, addressed feedback and gave it another test with 150 images and it seemed to go fine! I should really have provided a test case or something though
Motivation
The
:batchCreate
api which is used byuploadMultiple()
only supports a maximum of 50 media items per request as per the warning on this page and the following error response message when using the api:To work around this I capped mediaItems at 50 items per :batchCreate call and iteratively call :batchCreate until the list of images is exhausted. This allows users to input any amount of images for upload.
Manual Testing
I tested this with a sample of 2500 images works as intended. Although the timeout im forced to use right now slows the uploads down significantly, it does a maximum of 5 uploads/second right now due to the timeout alone. I was able to upload 2500 images to a google album with these changes in ~750 seconds.
caveats
upload
per minute. However, this is required for each image to upload to get an upload token that gets used with:batchCreate
. So far i worked around it with a timeout and i know thats not ideal but that opens the field for discussion i think... here is the error message it is not listed on the limits and quotas pagepossible solutions:
more...