-
Notifications
You must be signed in to change notification settings - Fork 823
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update the workbox-expiration IDB data model #1883
Conversation
// but don't `await` it as we don't want to block the response. | ||
const updateTimestampDone = cacheExpiration.updateTimestamp(request.url); | ||
if (event) { | ||
event.waitUntil(updateTimestampDone); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're going to need to put this in a try
/catch
, à la https://github.com/GoogleChrome/workbox/pull/1457/files
Samsung Internet 6.4, which I believe we're still trying to support, breaks when you call event.waitUntil()
asynchronously: #1435 (comment)
@@ -155,7 +163,7 @@ class Plugin { | |||
return true; | |||
} | |||
|
|||
// If we have a valid headerTime, then our response is fresh iff the | |||
// If we have a valid headerTime, then our response is fresh if the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh. I just saw the red underline in my editor and changed it without thinking.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. Updated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Jeff, I updated the PR with these changes.
@@ -155,7 +163,7 @@ class Plugin { | |||
return true; | |||
} | |||
|
|||
// If we have a valid headerTime, then our response is fresh iff the | |||
// If we have a valid headerTime, then our response is fresh if the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh. I just saw the red underline in my editor and changed it without thinking.
@@ -155,7 +163,7 @@ class Plugin { | |||
return true; | |||
} | |||
|
|||
// If we have a valid headerTime, then our response is fresh iff the | |||
// If we have a valid headerTime, then our response is fresh if the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. Updated.
PR-Bot Size PluginChanged File Sizes
New Files
All File SizesView Table
Workbox Aggregate Size Plugin8.78KB gzip'ed (59% of limit) |
R: @jeffposnick
Fixes #1398, Fixes #1400.
This PR updates the IDB data model used by
workbox-expiration
, switching it to from multiple databases (named the same as the cache name), to a single database (namedworkbox-expiration
) where the entries in the database have acacheName
property.I've also updated how expiration happens to make it more efficient. Previously the entire contents of the object store would be read out, the purgeable entires were determined, and then in a second transaction those entries would be removed. In this PR I've moved the logic that determines what needs to be expired into
CacheTimestampsModel
, so it can all happen inside a single transaction.Lastly, I had to update our IDB mocks yet again due to bugs I found when running tests. I've manually confirmed that the logic in this PR does work in Chrome, FF, and Safari's IDB implementations.