diff options
-rw-r--r-- | src/api/LocalApi.js | 4 | ||||
-rw-r--r-- | src/api/server/LocalApi.js | 17 | ||||
-rw-r--r-- | src/stores/AppStore.js | 9 |
3 files changed, 15 insertions, 15 deletions
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 { | |||
16 | return this.local.getAppCacheSize(); | 16 | return this.local.getAppCacheSize(); |
17 | } | 17 | } |
18 | 18 | ||
19 | clearAppCache() { | 19 | clearCache() { |
20 | return this.local.clearAppCache(); | 20 | return this.local.clearCache(); |
21 | } | 21 | } |
22 | } | 22 | } |
diff --git a/src/api/server/LocalApi.js b/src/api/server/LocalApi.js index 2d9af416f..cc8035523 100644 --- a/src/api/server/LocalApi.js +++ b/src/api/server/LocalApi.js | |||
@@ -41,17 +41,14 @@ export default class LocalApi { | |||
41 | }); | 41 | }); |
42 | } | 42 | } |
43 | 43 | ||
44 | async clearCache(serviceId) { | 44 | async clearCache(serviceId = null) { |
45 | const s = session.fromPartition(`persist:service-${serviceId}`); | 45 | const s = serviceId ? session.fromPartition(`persist:service-${serviceId}`) : session.defaultSession; |
46 | 46 | ||
47 | debug('LocalApi::clearCache resolves', serviceId); | 47 | debug('LocalApi::clearCache resolves', (serviceId || 'clearAppCache')); |
48 | return s.clearCache(); | 48 | await s.clearStorageData({ |
49 | } | 49 | storages: ['appcache', 'cookies', 'filesystem', 'indexdb', 'localstorage', 'shadercache', 'websql', 'serviceworkers', 'cachestorage'], |
50 | 50 | quotas: ['temporary', 'persistent', 'syncable'], | |
51 | async clearAppCache() { | 51 | }); |
52 | const s = session.defaultSession; | ||
53 | |||
54 | debug('LocalApi::clearCache clearAppCache'); | ||
55 | return s.clearCache(); | 52 | return s.clearCache(); |
56 | } | 53 | } |
57 | } | 54 | } |
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; |