workbox icon indicating copy to clipboard operation
workbox copied to clipboard

Long queue time on the initial index.html request during SW update with heavy precache

Open taozhou-glean opened this issue 1 year ago • 1 comments

Welcome! Please use this template for reporting bugs or requesting features. For questions about using Workbox, the best place to ask is Stack Overflow, tagged with [workbox]: https://stackoverflow.com/questions/ask?tags=workbox

Library Affected: workbox-precaching

Browser & Platform: all browsers

Issue or Feature Request Description:

notice long queue time on the initial index.html request when SW updates itself, especially when it requires a lot changes in precached assets, it seems the request on handling the index.html got blocked by all the other fetches happening on precache.

repro step is:

  1. on a website that precache a lot files (hundreds of them)
  2. clear the Cache but keep the service worker - you may also want to disable network cache
  3. enable update on reload for SW
  4. reload
image image

our precache setting is very short:

precacheAndRoute(self.__WB_MANIFEST, { ignoreURLParametersMatching: [/.*/] })

tho the __WB_MANIFEST is quite a lot, like ~500 assets , and it does include the index.html itself, not sure if that's the issue that why index.html request itself got queued there - I would expect it will serve the old version with the old service worker before precache finished

taozhou-glean avatar Feb 10 '24 00:02 taozhou-glean

tried to mark precache requests to low priority but still the highest request is waiting on low priority requests, seems wrong:

image

taozhou-glean avatar Feb 13 '24 17:02 taozhou-glean