ImperialCollegeLondon / django-drf-filepond

A Django app providing a server implemention for the Filepond file upload library
BSD 3-Clause "New" or "Revised" License
105 stars 40 forks source link

Fix timeout problem on client for large chunked uploads. #92

Open blattms opened 1 year ago

blattms commented 1 year ago

Putting those chunks together and moving the file to temporary storage might take quite some time. Hence the response to the upload of the last chunk might take longer than the timeout on the client.

In that case the client will retry uploading the last chunk and this would fail on the server with the following log message, because the upload is already complete (offset is the size of the uploaded file:

ERROR django_drf_filepond: uploaders Offset provided by client <22807552000> doesn't match the stored offset <22808122462> for chunked upload id ...

This change will do two things for the reupload attempts of the client:

  1. If the upload is already complete but the chunks are not yet put together then it will sleep a while and return HTTP error code 408
  2. If the upload was already put together successfully, then it will return success.