0
0
Fork 0

Cache media only when storage can be freed (#7547)

This commit is contained in:
Akihiko Odaki 2018-05-20 02:22:11 +09:00 committed by Eugen Rochko
parent bcbb6aa46f
commit 4e1400cecb
2 changed files with 8 additions and 6 deletions

View file

@ -1,4 +1,4 @@
import { freeStorage } from '../storage/modifier';
import { freeStorage, storageFreeable } from '../storage/modifier';
import './web_push_notifications';
function openSystemCache() {
@ -49,7 +49,7 @@ self.addEventListener('fetch', function(event) {
return response;
}));
} else if (process.env.CDN_HOST ? url.host === process.env.CDN_HOST : url.pathname.startsWith('/system/')) {
} else if (storageFreeable && process.env.CDN_HOST ? url.host === process.env.CDN_HOST : url.pathname.startsWith('/system/')) {
event.respondWith(openSystemCache().then(cache => {
return cache.match(event.request.url).then(cached => {
if (cached === undefined) {