Closed drzraf closed 2 years ago
I've a problem with the current code paths.
If I call await files[0].chunks[0].send();
(uploading only one chunk of one file), it'll call FlowChunk.doneHandler()
which in turn calls parent's flowObj.uploadNextChunk()
which read/consume/send all remaining chunks.
It's a counter-intuitive design. Wouldn't we prefer a more predictable chaining process?
I think you have mentioned this problem earlier. I agree that it can be improved
I also wonder about the following:
An
xhr.error();
=> doneHandler (status === 'error')
=> abort(true)
Why not using the retry()
logic? Eg: We may receive a 400 or Timeout error because of some bandwidth exhaustion and it's worth retrying don't you think?
The counter-intuitive pause()/resume()
design can be solved in a subsequent issue.
The current
pause
process consist into aborting all ongoing XHR object. Converselyresume
callFlow.upload()
again which goes over each pending chunk.In the case of ReadableStream we can not expect to
read()
twice a regular file (as expected byFlowChunk.send()
). A possible implementation could conserve the XHR payload in order to recreate it again (instead of settingFlowChunk
's XHR tonull
)