Skip to content

feat: Support multi-part uploads in JS API #115

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

Conversation

lucaas
Copy link
Contributor

@lucaas lucaas commented May 30, 2023

Resolves FT-cbc1aaec-2dcb-40a5-a298-4d85ea15851e

  • I have added automatic tests where applicable
  • The PR title is suitable as a release note
  • The PR contains a description of what has been changed
  • The description contains manual test instructions

Changes

  • Moves uploading functionality to a Uploader class to handle both single-part and multi-part uploads
  • Implements multi-part uploading (requires support in backend, added in 4.12.0.current.17)
  • Retries failed uploads using an exponential back-off.
  • This client behaved differently from the Python client and server, which marks the component as being in the location when data transfer is finished and then emits a component-added event.
    • Move creating ComponentLocation to after upload finishes.
    • Emit a component-added event.

Test

@lucaas lucaas requested a review from gismya May 30, 2023 10:32
Copy link
Contributor

@gismya gismya left a comment

Choose a reason for hiding this comment

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

Seems like a great start. Some inconsistencies in the async syntax used, I suggest making sure async/await is used consistently.

2 ** retry * 100
} before retrying...`
);
wait(2 ** retry * 100).then(() => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Intuitively, this feels short. Did you base this on anything?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've replaced this with a separate implementation in back_off.

It will wait a delay of 0.5s, then double that for each attempt up to a maximum of 64 seconds. It will attempt a maximum of 16 tries before giving up.

@lucaas lucaas marked this pull request as ready for review June 8, 2023 10:36
@lucaas lucaas requested a review from a team as a code owner June 8, 2023 10:36
@lucaas lucaas requested review from jimmycallin and nemanjab17 June 8, 2023 10:36
lucaas added 3 commits June 13, 2023 19:56
…loading-in-js-api' of github.com:ftrackhq/ftrack-javascript into backlog/multipart-upload-in-studio/support-multipart-uploading-in-js-api
@lucaas lucaas merged commit 20f4600 into main Jun 13, 2023
@lucaas lucaas deleted the backlog/multipart-upload-in-studio/support-multipart-uploading-in-js-api branch June 13, 2023 18:05
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.

3 participants