Service Worker and Cache Storage API: Coordinating asset updates during live migration
0 reputation · 06 Mar 2020, 20:34 UTC
The goal is to deploy a new version of a small HTML5 application without downtime while guaranteeing that all active pages immediately receive the freshly cached assets, avoiding mixed‑version serving.
Constraints include relying on self.skipWaiting() to promote a waiting worker and clients.claim() to take control of existing pages, but browser implementations vary in how quickly the waiting worker becomes active and whether a page refresh is required for the claim to affect cache lookups. This uncertainty raises the possibility that some requests may still hit the old cache after an update.
Does invoking self.skipWaiting() followed by clients.claim() in the activate event guarantee that all existing page controls instantly see the new cache across Chrome, Firefox, and Safari? If not, what additional steps are needed to prevent mixed‑version asset serving? Is a soft page reload sufficient to achieve consistency without introducing perceived downtime?