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
Resumable and chunked track upload #1484
Conversation
… + bring back original /t_c route + refactor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
High level this looks great! definitely do want to dig into how the PATCH/HEAD route works a bit more, don't think i fully understand that yet. but otherwise this is looking pretty good
const { wait } = require('../../utils') | ||
const uuid = require('../../utils/uuid') | ||
const SchemaValidator = require('../schemaValidator') | ||
|
||
const CHUNK_SIZE = 2000000 // 2MB |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dmanjunath @raymondjacobson this is the chunking size I decided to use. am open to changing this if either of you think there is a better chunking size. for large tracks, this chunking size might be too small
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think this seems reasonable. definitely shouldn't be less than 1MB or more than 2 or 3 so i think this feels right to begin with
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
am interested in having this in remove config at some point
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mostly looks good to me at this point! will want to very thoroughly QA on staging, but i love this!
can we fix the tests? |
yup, coming up |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work. This looks amazing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am so excited for this!!!
Description
What is the purpose of this PR? What is the current behavior? New behavior? Relevant links (e.g. Trello) and/or information pertaining to PR?
Context: Currently, when a user uploads a track, the entire file is uploaded. In conjunction with a bad network, the user will have to trouble uploading the track. This can cause frustration.
Purpose: This PR is to implement track upload chunking and resumable upload. More details are listed in the upload track design doc
In this PR:
fileManager.js
to two methods calledcheckFileType()
andcheckFileSize()
checkFileMiddleware()
that uses the ^ methods/track_content_status
route to/task_status
/track_content_upload
for chunking and resumable upload logicuseTrackContentPolling
anduseResumableTrackUpload
into libs CN instanceuploadTrackAudio()
to handle 3 different scenarios:startResumableUpload()
A high level flow chart of upload flow:
TODO:
Tests
List the manual tests and repro instructions to verify that this PR works as anticipated. Include log analysis if possible.
❗ If this change impacts clients, make sure that you have tested the clients ❗
Track upload works with flag conditions
Track upload succeeds with 3MB track
Track upload succeeds with 200MB track
Track upload succeeds with multiple tracks (album)
Track upload succeeds with uploads on multiple tabs
Track upload succeeds with fast network
Track upload succeeds with slow network (3G slow on console)
POST
Dapp handles track content upload middleware failing
Dapp handles track content upload logic before tus middleware failing
Dapp handles track content upload logic during tus middleware failing
Something went wrong with that request ENOENT: no such file or directory, open 'file_storage/files/tmp_track_artifacts/0cfe7b7d-a5d6-46a9-a2cc-98d36e2ec2db/d402b1a8-e263-47b4-9a78-9dae0655a4b1.mp3'
HEAD/PATCH
Dapp handles tmp file dir route middleware failing
Dapp handles tmp file dir route before tus middleware failing
Dapp handles tmp file dir route during tus middleware failing
PATCH 410 GONE The file for this url no longer exists