Cache media only when storage can be freed (#7547)
This commit is contained in:
		
					parent
					
						
							
								bcbb6aa46f
							
						
					
				
			
			
				commit
				
					
						4e1400cecb
					
				
			
		
					 2 changed files with 8 additions and 6 deletions
				
			
		|  | @ -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) { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue