-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Potential race condition with ApplicationCache #24
Comments
Just to correct my previous statement to be more accurate: disabling AppCache happens as part of the service worker activation algorithm, described as step 8 in https://w3c.github.io/ServiceWorker/#activation-algorithm. So it's once a registered service worker activates that AppCache is effectively disabled, not immediately following registration. I would probably not recommend this, but if you did want to go down the path of trying to register a no-op service worker as early as possible, the best way to do it would be:
If there's something about the way your AppCache manifest is set up that would prevent any of the caching operations that need to be performed in |
I don't think init() will throws an exception. There is an internal try-catch. I checked our logs and I could not find any instances of the error messaged logged in the catch clause. I am certain that the service worker is conflicting with app cache as I can see the app cache logs in the console while the service worker is registered. Given that it's going to be removed anyway we'll try to disable the app cache on the webview on our android app. Hopefully that will resolve this strange behavior. in case anyone reads it in the future, there are two erros that I have seen what that happans. There is a 500 error to fetch the appcache.manifest file. And we keep getting a cache updated event. |
Hi, we have been using the library successfuly for a couple of months now. However, we recently noticed that around 0.5% of our users are stuck on an old version. Two members of our dev team were able to reproduce the issue locally but unfortunately we do not have a reliable way to do so.
When the issue occured I noticed that the website has both legacy application cache as well as webservice cache. The issue could only be resolved by checking
by pass network
on the service worker and refreshing the page twice.This issue happaned on the Android version of Chrome 86 which still has ApplicationCache available.
I noticed that @jeffposnick mentioned
The example in the readme file has an wait statement before the service worker is registered
Could that be the root cause of the race condition? in our usecase we do an additional await for
await caches.keys()
before initializing the library.I was thinking we could add
navigator.serviceWorker.register('no-op-sw.js')
at the top of the HTML file just to disable ApplicationCache. Do you have any suggestions?The text was updated successfully, but these errors were encountered: