From ab39660497a45e843a3e7ffb6035b5d564ec5ee9 Mon Sep 17 00:00:00 2001 From: Mahadevan Sreenivasan Date: Fri, 10 Apr 2020 19:53:38 +0530 Subject: Fix cache clearing not working in Windows 10 (#541) (#544) * fix: Clear caches which is not working in Windows 10 (#541) - In AppStore, the partition directory of allorphanedserviceIds are attempted to be removed during clear cache. However, atleast in Windows, certain files like Cookies, indexedDB and other autogenerated ones during session creation are locked and hence fs.removeDirectory throws an exception. I have added a try catch around this piece of code to avoid uncaught exceptions which causes the spinner to spin indefnitely and prevents execution of further code - From electron docs - I found that calling session.clearstorage([options]) is a better way to clear session storage data. Hence, in LocalApi.js, we are clearing out all possible storages and quotas of all services and the default session. More info in this link - https://www.electronjs.org/docs/api/session#sesclearstoragedataoptions * refactor: LocalApi - refactor clearAppCache and clearCache(serviceId) as suggested by @eandrogehlen * refactor: #544 - Remove clearAppCache from server/LocalApi.js to use clearCache for clearing both service and application sessions. * fix: clear_cache - update function anme in AppStore.js to 'clearCache' instead of 'clearAppCache'. This got missed out during the refactor. Apologies. --- src/api/LocalApi.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/api/LocalApi.js') diff --git a/src/api/LocalApi.js b/src/api/LocalApi.js index e2a46874a..ccdedd3f5 100644 --- a/src/api/LocalApi.js +++ b/src/api/LocalApi.js @@ -16,7 +16,7 @@ export default class LocalApi { return this.local.getAppCacheSize(); } - clearAppCache() { - return this.local.clearAppCache(); + clearCache() { + return this.local.clearCache(); } } -- cgit v1.2.3-70-g09d2