-
Notifications
You must be signed in to change notification settings - Fork 612
Closed
Description
During a large upload, the sent resumableTotalChunks parameter can sometimes not be the actual value and can differ between chunks sent.
Dev Notes
I have looked into the possible reason and have narrowed it down to the following:
ResumableFile.bootstrapis called to initialise all theResumableChunksand store them in theResumableFile.chunksarray.- Once
bootstrapis completed the upload of theResumableFileis allowed to begin - However, on completion, the
bootstrapfunction has not added any chunks to thechunksarray - This is due to the
window.setTimeoutsurrounding the actual push of the new chunk (making it run asynchronously), forcing thebootstrapfunction to complete before all thesetTimeoutcontents have completed.
- Therefore, this is allowing
uploadto be started whilst theResumableChunksare still being added to thechunksarray - As the
resumableTotalChunksparameter is determined from the length of thechunksarray, this is what it causing the fluctuation.
Example
Example request parameters sent:
- note the change in
resumableTotalChunks - also how it is not the actual value of 984
resumableChunkNumber=2&resumableChunkSize=1048576&resumableCurrentChunkSize=1048576&resumableTotalSize=1031744025&resumableType=&resumableIdentifier=###&resumableFilename=###&resumableRelativePath=###&resumableTotalChunks=394
resumableChunkNumber=3&resumableChunkSize=1048576&resumableCurrentChunkSize=1048576&resumableTotalSize=1031744025&resumableType=&resumableIdentifier=###&resumableFilename=###&resumableRelativePath=###&resumableTotalChunks=400
Possible fixes
- Remove the
setTimeoutaround the push to the array - Determine the totalChunks using the
fileSizeandchunkSizerather than length ofchunksarray
Metadata
Metadata
Assignees
Labels
No labels
