When assigning configuration, the documentation states that target property can be a function.
While utilizing it as a function, wait for it to complete or return a response before starting the upload process so a proper URL is returned.
USECASE:
simultaneousUploads is set to something bigger than 1, let's say 5
Flow starts uploading file in 5 chunks at a time.
Server is now facing a race condition because the chunks are being sent simultaneously hence database entries are created at the same time causing duplicate entries.
File upload process is now corrupted.
For a healthy way of implementation to ensure the race condition is averted with proper back-end reference to the file, allow the target option to be a function and wait until it returns a response, which is a unique url for the file to be uploaded to.
Problem
Currently the Flow object does not wait to start uploading the file until after the target function returns a response.
When assigning configuration, the documentation states that
target
property can be a function.While utilizing it as a function, wait for it to complete or return a response before starting the upload process so a proper URL is returned.
USECASE:
simultaneousUploads
is set to something bigger than 1, let's say 5For a healthy way of implementation to ensure the race condition is averted with proper back-end reference to the file, allow the
target
option to be a function and wait until it returns a response, which is a unique url for the file to be uploaded to.Problem
Currently the Flow object does not wait to start uploading the file until after the
target
function returns a response.