Consider periodically updating service workers in the background (based on heuristics like site engagement metrics) |
||||
Issue descriptionCurrently service workers only check for updates (updated service worker file) when you visit a controlled page. Common scenario with service worker controlled pages (such as PWAs): 1.) Visit SW-controlled page 2.) Page is served from SW cache of currently installed SW 3.) New SW is detected, it is installed in the background while user is on page 4.) New SW updates resources in cache 5.) SW-controlled page gets 'controllerchange' event if new SW skips waiting 6.) SW-controlled page must now continue with now-stale site, reload the page forceably, or prompt the user to do so. This results in a sub-par user experience, especially for PWAs that update fairly regularly. It would be great if checks for new service workers and kicking off the install process could happen periodically in the background, at least for frequently used PWAs. This will reduce the gap between PWAs and native apps.
,
Nov 7
This should probably be discussed as a spec issue. And I think the spec might have used to have automatic updates in the background but it was removed from the spec. For example this issue mentions "controllers must be checked every 24 hours": https://github.com/w3c/ServiceWorker/issues/43 Jake, do you recall why it was removed?
,
Nov 7
I think the spec permits it in Soft Update: "The user agent may call this as often as it likes to check for updates."
,
Nov 7
True, but it feels like an interop issue if sites have to deal with update-on-navigate for some browsers, but get background update for other browsers.
,
Nov 7
Ah I thought we'd still do update-on-navigate all the time, and in addition to that sometimes do spontaneous Soft Update for frequently used SWs.
,
Nov 7
Also want to mention that "Add to homescreen" could be another useful signal in addition to high engagement to determine soft update eligibility. Users could use an web app only occasionally but think it is important enough to install to their device and may want an up-to-date version when they do launch it.
,
Nov 9
,
Nov 9
Kenji: Adding for PM visibility to help gauge priority. |
||||
►
Sign in to add a comment |
||||
Comment 1 by falken@chromium.org
, Nov 7Summary: Consider periodically updating service workers that have high site engagement (was: Allow service workers to update in the background)