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

@uppy/aws-s3-multipart: add shouldUseMultipart option #4205

Merged
merged 16 commits into from
May 2, 2023

Conversation

aduh95
Copy link
Member

@aduh95 aduh95 commented Nov 9, 2022

When uploading small files (e.g. ≤100MiB), using multipart can decrease the upload performance as it introduces more overhead for uploading just one part.
This can be solved without too much difficulty by hitting the non-multipart endpoint for files with only one chunk.

@Murderlon Murderlon marked this pull request as draft November 10, 2022 14:40
@Murderlon Murderlon added 💬 Discussion AWS S3 Plugin that handles uploads to Amazon AWS S3 labels Nov 10, 2022
@aduh95
Copy link
Member Author

aduh95 commented Nov 13, 2022

If we want to migrate all users of @uppy/aws-s3 to @uppy/aws-s3-multipart (making on the alias of the other), here's what we need to do in order to not make it a breaking change (regarding public API options, unification will probably be a breaking change on itself).

@aduh95 aduh95 force-pushed the one-s3-plugin-to-rule-them-all branch from 2b5d9a4 to f7c54db Compare April 26, 2023 14:38
@aduh95 aduh95 marked this pull request as ready for review April 26, 2023 14:38
@aduh95 aduh95 changed the title @uppy/aws-s3-multipart: add support for non-multipart uploads @uppy/aws-s3-multipart: add shouldUseMultipart option Apr 26, 2023
@@ -43,6 +43,7 @@ export interface AwsS3MultipartOptions extends PluginOptions {
opts: { uploadId: string; key: string; parts: AwsS3Part[]; signal: AbortSignal }
) => MaybePromise<{ location?: string }>
limit?: number
shouldUseMultipart?: boolean | ((file: UppyFile, fileSize: number) => boolean)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is fileSize the second argument? Doesn't it already live in file?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's provided as a convenience.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's cleaner to just have file. It's not some deep object, it's simply file.size. We can add another argument in the future when people start using it more and need more things or conveniences.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that if UppyFile always has a .size, then it's unnecessary/confusing/redundant to have a separate argument for it as well

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed.

i think it can be considered a breaking change, because i'm changing the signature of uploadPartBytes, which is an option. however I don't see uploadPartBytes documented in our docs, so maybe we can get away with a non major:

- onProgress now gets passed number of bytes instead of `ev`
- a new `size` argument (previously size was on body)
@arturi arturi merged commit 8e15f27 into main May 2, 2023
15 checks passed
@arturi arturi deleted the one-s3-plugin-to-rule-them-all branch May 2, 2023 18:34
@github-actions github-actions bot mentioned this pull request May 2, 2023
github-actions bot added a commit that referenced this pull request May 2, 2023
| Package                | Version | Package                | Version |
| ---------------------- | ------- | ---------------------- | ------- |
| @uppy/aws-s3           |   3.1.1 | @uppy/status-bar       |   3.1.2 |
| @uppy/aws-s3-multipart |   3.3.0 | @uppy/transloadit      |   3.1.4 |
| @uppy/locales          |   3.2.1 | uppy                   |   3.9.0 |

- @uppy/aws-s3-multipart: allowedMetaFields: null means “include all” (Artur Paikin / #4437)
- @uppy/aws-s3-multipart: add `shouldUseMultipart ` option (Antoine du Hamel / #4205)
- @uppy/transloadit: Reset `tus` key in the file on error, so retried files are re-uploaded (Artur Paikin / #4421)
- meta: commit build file that was modified (Antoine du Hamel)
- meta: examples: add CORS settings for DigitalOcean Spaces (Antoine du Hamel / #4428)
- @uppy/aws-s3: deprecate `timeout` option (Antoine du Hamel / #4298)
- @uppy/aws-s3-multipart: make retries more robust (Antoine du Hamel / #4424)
- meta: fix badges on README (Antoine du Hamel / #4419)
@@ -206,6 +265,9 @@ class HTTPCommunicationQueue {

async resumeUploadFile (file, chunks, signal) {
throwIfAborted(signal)
if (chunks.length === 1) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AWS S3 Plugin that handles uploads to Amazon AWS S3 💬 Discussion
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants