Open avernet opened 1 week ago
Right now, the XFCD keeps a pendingUploads
set . This is:
xxforms-upload-start
-removed from when
xxforms-upload-cancel|done|error
pending-uploads
actionNow, in the case of a multiple file upload, each upload is sent separately on the client. We have a processFileList()
function
based on Future
which sends each file at at time using addFile()
.
So it is possible that the save-final()
process, which uses the pending-uploads
, catches pendingUploads
just at a time between two uploads of a multiple-upload sequence. Ideally, this shouldn't happen, and save-final()
should not be allowed to proceed.
Note that this could also happen in even with separate upload controls. So the client should somehow be able to tell the server whether there are pending uploads on the client.
The client keeps a pending uploads queue in UploaderClient
. Sequence of events:
xxforms-upload-start
xxforms-upload-done
or xxforms-upload-error
xxforms-upload-done
or xxforms-upload-error
(within "server events")xxforms-upload-error
explicitlyxxforms-upload-start
One difficulty is to make sure the client and the server are synchronized. You don't want, for example, the client to tell the server that 3 uploads are expected, 1 upload completes, the client somehow is interrupted, and the server forever expects 2 more uploads, while the client no longer knows about it.
Adding files to the queue, even though it is based on Future
, allows, at least in "online" mode, to fill the pending uploads queue as uploads are added. So at the end of an upload, we know if there are pending uploads on the client. Could we, at the same time we send xxforms-upload-done
or xxforms-upload-error
to the server, send a new xxforms-upload-start
just before that?
Q: What happens with xxforms-upload-start
/xxforms-upload-done
in the case of multiple file uploads? Are they dispatched to the same XForms control, or different ones?
So, attachment.xbl
has a single xf:upload
, which uploads to the local instance. Upon xxforms-upload-done
, it copies over the the data as appropriate.
So, in the case of a multiple attachments control, it doesn't quite make sense from a sequence point of view to dispatch xxforms-upload-start
before xxforms-upload-done
or xxforms-upload-error
, does it? We'd like the start
/done|error
to be paired. In addition, the id will be added to the list of pending uploads, and the subsequent done|error
will remove it. So It think that option will not work.
To reproduce:
/new
, attach several files, and click Save while the files are still uploading (network throttling helps).Result:
+1 from customer