You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After it's successfully installed, the updated service worker delays activating until the existing service worker is no longer controlling clients. This state is called "waiting", and it's how the browser ensures that only one version of your service worker is running at a time.
However, that last sentence is somewhat non-sensical / wrong, because it's contradicted later down the page here:
The waiting phase means you're only running one version of your site at once, but if you don't need that feature, you can make your new service worker activate sooner by calling self.skipWaiting().
This causes your service worker to kick out the current active worker and activate itself as soon as it enters the waiting phase (or immediately if it's already in the waiting phase). It doesn't cause your worker to skip installing, just waiting.
Since calling self.skipWaiting() kicks out the old service worker, there is still only "one version" of the service worker running at a time. So it sounds like we can safely call self.skipWaiting() all the time.
Solution
Double-check what I'm saying above, and if it's right:
Call self.skipWaiting()
Do a manual call to update() on page refresh
Call update() once per hour
And we may also want to call clients.claim()
The text was updated successfully, but these errors were encountered:
* add a sbp selector for manually updating the service-worker
* call Registration.update() immediately / set up 1hr periodic timer for it
* remove useless console.log
* check WebSocket.CLOSED / WebSocket.CLOSING before sending message to the push-server
* set up a event listener for PUBSUB_RECONNECTION_SUCCEEDED sbp event
* fix the typo
* minor updates
Problem
Have a look at this comment.
It turns out that the way that service workers update is a bit convoluted and non-optimal by default.
The article says:
However, that last sentence is somewhat non-sensical / wrong, because it's contradicted later down the page here:
Since calling
self.skipWaiting()
kicks out the old service worker, there is still only "one version" of the service worker running at a time. So it sounds like we can safely callself.skipWaiting()
all the time.Solution
Double-check what I'm saying above, and if it's right:
self.skipWaiting()
update()
on page refreshupdate()
once per hourclients.claim()
The text was updated successfully, but these errors were encountered: