Skip to content

armgit / ente

Public Imported from GitHub
0

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

Fix duplicate file uploads when initializing a folder watch

Manav Rathidd1e0a9b1d09
diff --git a/desktop/src/main/services/watch.ts b/desktop/src/main/services/watch.ts
index e9629ff703..a65fade8f5 100644
--- a/desktop/src/main/services/watch.ts
+++ b/desktop/src/main/services/watch.ts
@@ -23,6 +23,12 @@ export const createWatcher = (mainWindow: BrowserWindow) => {
const folderPaths = folderWatches().map((watch) => watch.folderPath);
const watcher = chokidar.watch(folderPaths, {
+ // Don't emit "add" events for matching paths when instantiating the
+ // watch (we do a full disk scan on launch on our own, and also getting
+ // the same events from the watcher causes duplicates).
+ ignoreInitial: true,
+ // Ask the watcher to wait for a the file size to stabilize before
+ // telling us about a new file. By default, it waits for 2 seconds.
awaitWriteFinish: true,
});