From 70973b22817059e8d81f1d3db288d0d0a77c04c5 Mon Sep 17 00:00:00 2001 From: TC Date: Wed, 24 Feb 2021 21:08:25 +0100 Subject: [PATCH] Clear cache after 20s if option is enabled --- index.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index a894b1fc..915c5069 100644 --- a/index.js +++ b/index.js @@ -209,8 +209,14 @@ app.on("activate", () => { app.on("ready", () => { if (config.get("options.autoResetAppCache")) { - // Clear cache - electron.session.defaultSession.clearCache(); + // Clear cache after 20s + const clearCacheTimeout = setTimeout(() => { + if (is.dev()) { + console.log("Clearing app cache."); + } + electron.session.defaultSession.clearCache(); + clearTimeout(clearCacheTimeout); + }, 20000); } mainWindow = createMainWindow();