Skip to content

armgit / ente

Public Imported from GitHub
0

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

Clear

Manav Rathi5c3cfb74038a
diff --git a/desktop/src/main/services/logout.ts b/desktop/src/main/services/logout.ts
index 37e73309a4..ab031b9112 100644
--- a/desktop/src/main/services/logout.ts
+++ b/desktop/src/main/services/logout.ts
@@ -3,6 +3,7 @@ import log from "../log";
import { clearConvertToMP4Results } from "../stream";
import { clearStores } from "./store";
import { watchReset } from "./watch";
+import { clearOpenZipCache } from "./zip";
/**
* Perform the native side logout sequence.
@@ -30,4 +31,9 @@ export const logout = (watcher: FSWatcher) => {
} catch (e) {
ignoreError("native stores", e);
}
+ try {
+ clearOpenZipCache();
+ } catch (e) {
+ ignoreError("zip cache", e);
+ }
};
diff --git a/desktop/src/main/services/upload.ts b/desktop/src/main/services/upload.ts
index 516fbe6dde..3fffc68b5a 100644
--- a/desktop/src/main/services/upload.ts
+++ b/desktop/src/main/services/upload.ts
@@ -5,6 +5,7 @@ import { existsSync } from "original-fs";
import type { PendingUploads, ZipItem } from "../../types/ipc";
import log from "../log";
import { uploadStatusStore } from "../stores/upload-status";
+import { clearOpenZipCache } from "./zip";
export const listZipItems = async (zipPath: string): Promise<ZipItem[]> => {
const zip = new StreamZip.async({ file: zipPath });
@@ -152,4 +153,7 @@ export const markUploadedZipItems = (
uploadStatusStore.set("zipItems", updated);
};
-export const clearPendingUploads = () => uploadStatusStore.clear();
+export const clearPendingUploads = () => {
+ uploadStatusStore.clear();
+ clearOpenZipCache();
+};
diff --git a/web/packages/next/types/ipc.ts b/web/packages/next/types/ipc.ts
index 646ec79127..21246ea660 100644
--- a/web/packages/next/types/ipc.ts
+++ b/web/packages/next/types/ipc.ts
@@ -567,6 +567,9 @@ export interface Electron {
/**
* Clear any pending uploads.
+ *
+ * This is also taken by the Node.js layer as a signal to clear any cached
+ * state it has kept around to speed up the upload.
*/
clearPendingUploads: () => Promise<void>;
}