pop schedule a file for a new upload
This commit is contained in:
parent
0641263e5c
commit
0b6aba1856
|
@ -213,18 +213,21 @@ class UploadService {
|
||||||
const uploadProcesses = [];
|
const uploadProcesses = [];
|
||||||
for (
|
for (
|
||||||
let i = 0;
|
let i = 0;
|
||||||
i < Math.min(MAX_CONCURRENT_UPLOADS, this.totalFileCount);
|
i < MAX_CONCURRENT_UPLOADS;
|
||||||
i++
|
i++
|
||||||
) {
|
) {
|
||||||
|
if (this.filesToBeUploaded.length>0) {
|
||||||
|
const fileWithCollection= this.filesToBeUploaded.pop();
|
||||||
this.cryptoWorkers[i] = getDedicatedCryptoWorker();
|
this.cryptoWorkers[i] = getDedicatedCryptoWorker();
|
||||||
uploadProcesses.push(
|
uploadProcesses.push(
|
||||||
this.uploader(
|
this.uploader(
|
||||||
await new this.cryptoWorkers[i].comlink(),
|
await new this.cryptoWorkers[i].comlink(),
|
||||||
new FileReader(),
|
new FileReader(),
|
||||||
this.filesToBeUploaded.pop(),
|
fileWithCollection,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
progressBarProps.setUploadStage(UPLOAD_STAGES.UPLOADING);
|
progressBarProps.setUploadStage(UPLOAD_STAGES.UPLOADING);
|
||||||
await Promise.all(uploadProcesses);
|
await Promise.all(uploadProcesses);
|
||||||
progressBarProps.setUploadStage(UPLOAD_STAGES.FINISH);
|
progressBarProps.setUploadStage(UPLOAD_STAGES.FINISH);
|
||||||
|
@ -245,9 +248,6 @@ class UploadService {
|
||||||
reader: FileReader,
|
reader: FileReader,
|
||||||
fileWithCollection: FileWithCollection,
|
fileWithCollection: FileWithCollection,
|
||||||
) {
|
) {
|
||||||
if (!fileWithCollection) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const { file: rawFile, collection } = fileWithCollection;
|
const { file: rawFile, collection } = fileWithCollection;
|
||||||
this.fileProgress.set(rawFile.name, 0);
|
this.fileProgress.set(rawFile.name, 0);
|
||||||
this.updateProgressBarUI();
|
this.updateProgressBarUI();
|
||||||
|
|
Loading…
Reference in a new issue