DEV Community

samjiv kumar
samjiv kumar

Posted on

Uploading time is increasing gradually when we are uploading image more than 2000-3000

We have made webapp for uplaoding image.for that we are using angular and Firabase storage. When we start to upload image more than 2000-3000,intially uploading time is almost constant for 600-700 images but after that, uploading time is increasing gradually. which is creating big issue. we have already tested with constant internet speed (add throttling in developer tools in chrome) and same images size. but still upload time is increasing gradually.

Code snipet:-
const path = users/${this.user.uid}/${this.projectName}/${this.file.name};
this.fileName = this.file.name;
const ref = this.storage.ref(path);
this.task = ref.put(this.file, {
customMetadata: { projectName: this.projectName, contentType: 'image/jpeg' }
});
let flag = false;
this.snapshot = this.task.snapshotChanges().pipe(
finalize(async () => {
if (!flag) {
try {
flag = true;
this.projectService.uploadedFileCount({
key: COUNT_UPDATE
});
} catch (err) {}
this.endTime = new Date().getTime();
this.emitCompleteSignal.emit(1);
const diff = this.endTime - this.startTime;
const seconds = diff;
this.emitCompleteSignalFileInfo.emit(this.file.size + '###' + seconds);
}
})
);
}

Please help me on that.

Top comments (0)