Re: [ServiceWorker] 24 hour spontaneous update doesn't seem specced (#514)

`.update()` allows me to check for updates to the service worker outside of the usual schedule, but I don't see why the SW fetch should behave any differently to `fetch(url)` or `cache.add(url)` in terms of cache interaction.

I might call `.update()` when page visibility changes, or on a long `setTimeout`, but if I don't want it to http-cache it shouldn't have a `max-age` higher than 0 set.

> You may have already set it to 100000, so by the time you realize you want it to set it to 0 to push out an emergency update it's too late

If all your resources are served from the cache, all you can do is fix the SW cache headers and wait (a maximum of) 24hrs. Even if `.update` ignores the cache, it's impossible to get the page to run that.

If you're not serving everything from the cache, you can call `.register` and give the SW url a querystring, eg 'sw.js?v2'. Although I'm not against an option to `.update` that causes a cache-bypass.

If I'm trying to recover from a max-age incident, would I call `.update({bypassCache: true})` per page load for 24hrs? Will that cause double requests for users that didn't see a SW with a max-age?

---
Reply to this email directly or view it on GitHub:
https://github.com/slightlyoff/ServiceWorker/issues/514#issuecomment-130664373

Received on Thursday, 13 August 2015 13:13:34 UTC