mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 11:35:04 +01:00
upload smallest attachments first
so you don't get a delay at the end of the upload when starting a new request
This commit is contained in:
parent
a23075a326
commit
0581066350
@ -108,7 +108,10 @@ export class PendingEvent {
|
|||||||
}
|
}
|
||||||
this._status = SendStatus.UploadingAttachments;
|
this._status = SendStatus.UploadingAttachments;
|
||||||
this._emitUpdate("status");
|
this._emitUpdate("status");
|
||||||
for (const [urlPath, attachment] of Object.entries(this._attachments)) {
|
const entries = Object.entries(this._attachments);
|
||||||
|
// upload smallest attachments first
|
||||||
|
entries.sort(([, a1], [, a2]) => a1.size - a2.size);
|
||||||
|
for (const [urlPath, attachment] of entries) {
|
||||||
await attachment.upload(hsApi, () => {
|
await attachment.upload(hsApi, () => {
|
||||||
this._emitUpdate("attachmentsSentBytes");
|
this._emitUpdate("attachmentsSentBytes");
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user