Fixing missing attribute error

This commit is contained in:
Brandon Rozek 2024-10-20 12:18:24 -04:00
parent fd496d7cdd
commit 5ae3c63834
No known key found for this signature in database
GPG key ID: 26E457DA82C9F480

View file

@ -35,11 +35,15 @@ function trimCache(name, maxItems) {
return caches.open(name)
.then(cache => Promise.all([cache, cache.keys()]))
// Make sure offlineFundamentals don't get deleted
.then(([cache, keys]) => [cache, keys.filter(key => !offlineFundamentals.includes(key))])
.then(([cache, possibleDelete]) => {
.then(([cache, keys]) => [
cache,
keys.filter(key => !offlineFundamentals.includes(key)),
keys.length - maxItems
])
.then(([cache, possibleDelete, numToDelete]) => {
// Trim cache until we are of the right size
deleteInProgress = []
for (let i = 0; i < keys.length - maxItems; i++) {
for (let i = 0; i < numToDelete; i++) {
// Keep track of each delete
deleteInProgress.push(cache.delete(possibleDelete[i]));
}