Skip to content

armgit / ente

Public Imported from GitHub
0

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

Remove ad-hoc retry

Manav Rathi548724ae0a22
diff --git a/web/apps/photos/src/services/export/index.ts b/web/apps/photos/src/services/export/index.ts
index 53192409a7..27a28d456e 100644
--- a/web/apps/photos/src/services/export/index.ts
+++ b/web/apps/photos/src/services/export/index.ts
@@ -21,7 +21,6 @@ import {
import { getAllLocalFiles } from "@/new/photos/services/files";
import { safeDirectoryName, safeFileName } from "@/new/photos/utils/native-fs";
import { writeStream } from "@/new/photos/utils/native-stream";
-import { wait } from "@/utils/promise";
import { CustomError } from "@ente/shared/error";
import { LS_KEYS, getData, setData } from "@ente/shared/storage/localStorage";
import QueueProcessor, {
@@ -877,7 +876,7 @@ class ExportService {
}
}
- async getExportRecord(folder: string, retry = true): Promise<ExportRecord> {
+ async getExportRecord(folder: string): Promise<ExportRecord> {
const electron = ensureElectron();
const fs = electron.fs;
try {
@@ -887,19 +886,8 @@ class ExportService {
return this.createEmptyExportRecord(exportRecordJSONPath);
}
const recordFile = await fs.readTextFile(exportRecordJSONPath);
- try {
- return JSON.parse(recordFile);
- } catch (e) {
- throw Error(CustomError.EXPORT_RECORD_JSON_PARSING_FAILED);
- }
+ return JSON.parse(recordFile);
} catch (e) {
- if (
- e.message === CustomError.EXPORT_RECORD_JSON_PARSING_FAILED &&
- retry
- ) {
- await wait(1000);
- return await this.getExportRecord(folder, false);
- }
if (e.message !== CustomError.EXPORT_FOLDER_DOES_NOT_EXIST) {
log.error("export Record JSON parsing failed", e);
}
diff --git a/web/packages/shared/error/index.ts b/web/packages/shared/error/index.ts
index 680f4e54f7..57f00e141b 100644
--- a/web/packages/shared/error/index.ts
+++ b/web/packages/shared/error/index.ts
@@ -44,7 +44,6 @@ export const CustomError = {
EXPORT_FOLDER_DOES_NOT_EXIST: "export folder does not exist",
AUTH_KEY_NOT_FOUND: "auth key not found",
PROCESSING_FAILED: "processing failed",
- EXPORT_RECORD_JSON_PARSING_FAILED: "export record json parsing failed",
TWO_FACTOR_ENABLED: "two factor enabled",
};