Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Conv 2

Manav Rathi3587f8cafdd3
diff --git a/web/packages/gallery/services/upload/upload-service.ts b/web/packages/gallery/services/upload/upload-service.ts
index 4a2dade203..bce9a84c94 100644
--- a/web/packages/gallery/services/upload/upload-service.ts
+++ b/web/packages/gallery/services/upload/upload-service.ts
@@ -141,7 +141,7 @@ class UploadService {
async setFileCount(fileCount: number) {
this.pendingUploadCount = fileCount;
- await this.preFetchUploadURLs();
+ await this.refillUploadURLs(); /* prefetch */
}
reducePendingUploadCount() {
@@ -149,26 +149,14 @@ class UploadService {
}
async getUploadURL() {
- if (this.uploadURLs.length === 0 && this.pendingUploadCount) {
+ if (this.uploadURLs.length == 0 && this.pendingUploadCount) {
await this.refillUploadURLs();
- this.ensureUniqueUploadURLs();
}
const url = this.uploadURLs.pop();
if (!url) throw new Error("Failed to obtain upload URL");
return url;
}
- private async preFetchUploadURLs() {
- try {
- await this.refillUploadURLs();
- // checking for any subscription related errors
- } catch (e) {
- log.error("prefetch uploadURL failed", e);
- handleUploadError(e);
- }
- this.ensureUniqueUploadURLs();
- }
-
async postFile(file: PostEnteFileRequest) {
return this.publicAlbumsCredentials
? postPublicAlbumsEnteFile(file, this.publicAlbumsCredentials)
@@ -184,9 +172,9 @@ class UploadService {
} finally {
this.activeUploadURLRefill = undefined;
}
- }
- private ensureUniqueUploadURLs() {
+ // Ensure that the upload URLs we have are unique.
+ //
// Sanity check added when this was a new implementation. Have kept it
// around, but it can be removed too.
if (