Skip to content

armgit / ente

Public Imported from GitHub
0

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

[desktop] Reduce chokidar polling frequency on macOS to fix high CPU usage

Anand Baburajan50d9c3b6a780
diff --git a/desktop/src/main/services/watch.ts b/desktop/src/main/services/watch.ts
index 15f0daccda..628ce88847 100644
--- a/desktop/src/main/services/watch.ts
+++ b/desktop/src/main/services/watch.ts
@@ -34,7 +34,14 @@ export const createWatcher = (mainWindow: BrowserWindow) => {
//
// The recommended workaround for now is to enable usePolling. Since it
// comes at a performance cost, we only do it where needed (macOS).
- ...(process.platform == "darwin" ? { usePolling: true } : {}),
+ //
+ // Polling with the default interval (100ms) causes high CPU usage for
+ // large folders (e.g. 10,000+ files). Increasing the interval to 5
+ // seconds significantly reduces CPU while still detecting new files
+ // within a reasonable time for a backup use case.
+ ...(process.platform == "darwin"
+ ? { usePolling: true, interval: 5000, binaryInterval: 5000 }
+ : {}),
});
watcher