Skip to content
This repository has been archived by the owner on Jul 19, 2023. It is now read-only.

Service worker doesn't always update in background #109

Open
leonardr opened this issue May 11, 2017 · 2 comments
Open

Service worker doesn't always update in background #109

leonardr opened this issue May 11, 2017 · 2 comments
Assignees

Comments

@leonardr
Copy link

I'm not going to do a great job of summarizing this issue, but here we go.

There are situations where the service worker tries to fetch a new version of a resource, but it isn't able to. In this situation it just stops trying to fetch the new version, even if the browser user does a hard refresh. This leads to old content being displayed even though HTTP requests are apparently going out and coming back with 200 response codes.

A simple solution is to stop using service workers and fall back to application cache. This will eventually stop working, but it should be okay in the short term.

A proper solution depends on figuring out when the service worker gives up on its background request.

@leonardr
Copy link
Author

Amy's recommendation is to take out service worker for now.

@aslagle
Copy link
Collaborator

aslagle commented May 11, 2017

The way the service worker is currently set up it will serve a resource immediately from cache, then try to fetch an update and cache it for the next time. However, the browser may terminate the service worker before the update finishes.

Another problem is that the service worker currently handles every request on the domain. It should probably be limited to urls that were explicitly cached.

This repository currently has two Cacher implementations - ApplicationCacheCacher, and ServiceWorkerCacher which falls back to ApplicationCacheCacher when the browser does not support service workers. If the current service worker setup causes problems for an implementation, it can use the ApplicationCacheCacher instead.

@jce1028 jce1028 modified the milestone: 1.1 May 11, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants