aboutsummaryrefslogtreecommitdiffstats
path: root/src/stores/AppStore.js
diff options
context:
space:
mode:
authorLibravatar Mahadevan Sreenivasan <mahadevan_sv@yahoo.com>2020-04-10 19:53:38 +0530
committerLibravatar GitHub <noreply@github.com>2020-04-10 15:23:38 +0100
commitab39660497a45e843a3e7ffb6035b5d564ec5ee9 (patch)
tree0468700c60f703a81b5462c59202a2f152b3dbf0 /src/stores/AppStore.js
parentdocs: add JakeSteam as a contributor (#556) (diff)
downloadferdium-app-ab39660497a45e843a3e7ffb6035b5d564ec5ee9.tar.gz
ferdium-app-ab39660497a45e843a3e7ffb6035b5d564ec5ee9.tar.zst
ferdium-app-ab39660497a45e843a3e7ffb6035b5d564ec5ee9.zip
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.
Diffstat (limited to 'src/stores/AppStore.js')
-rw-r--r--src/stores/AppStore.js9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/stores/AppStore.js b/src/stores/AppStore.js
index c8adb9c3c..e2e3760a8 100644
--- a/src/stores/AppStore.js
+++ b/src/stores/AppStore.js
@@ -52,7 +52,7 @@ export default class AppStore extends Store {
52 52
53 @observable getAppCacheSizeRequest = new Request(this.api.local, 'getAppCacheSize'); 53 @observable getAppCacheSizeRequest = new Request(this.api.local, 'getAppCacheSize');
54 54
55 @observable clearAppCacheRequest = new Request(this.api.local, 'clearAppCache'); 55 @observable clearAppCacheRequest = new Request(this.api.local, 'clearCache');
56 56
57 @observable autoLaunchOnStart = true; 57 @observable autoLaunchOnStart = true;
58 58
@@ -378,8 +378,11 @@ export default class AppStore extends Store {
378 const allServiceIds = await getServiceIdsFromPartitions(); 378 const allServiceIds = await getServiceIdsFromPartitions();
379 const allOrphanedServiceIds = allServiceIds.filter(id => !this.stores.services.all.find(s => id.replace('service-', '') === s.id)); 379 const allOrphanedServiceIds = allServiceIds.filter(id => !this.stores.services.all.find(s => id.replace('service-', '') === s.id));
380 380
381 await Promise.all(allOrphanedServiceIds.map(id => removeServicePartitionDirectory(id))); 381 try {
382 382 await Promise.all(allOrphanedServiceIds.map(id => removeServicePartitionDirectory(id)));
383 } catch (ex) {
384 console.log('Error while deleting service partition directory - ', ex);
385 }
383 await Promise.all(this.stores.services.all.map(s => this.actions.service.clearCache({ serviceId: s.id }))); 386 await Promise.all(this.stores.services.all.map(s => this.actions.service.clearCache({ serviceId: s.id })));
384 387
385 await clearAppCache._promise; 388 await clearAppCache._promise;