workbox
workbox copied to clipboard
cache.add(precacheAndRoute) will block the main thread, such as network bandwidth?
Library Affected: _workbox-sw
Browser & Platform: Chrome
Issue or Feature Request Description: I thought it would request resources when the main thread is idle.
I have a very simple example here. example First of all, I copied this repo( https://github.com/mdn/sw-test ), it was very smooth. Next, I made some changes. I add 1000 pictures(or more) in 'cache.add', When reloading, then i found that the main thread is block.
+const lotList = [];
+for (let index = 1; index < 1000; index++) {
+ lotList.push(`/sw-test/gallery/${index}.jpg`);
+}
+
const putInCache = async (request, response) => {
const cache = await caches.open('v1');
await cache.put(request, response);
@@ -69,6 +74,7 @@ self.addEventListener('install', (event) => {
'/sw-test/gallery/bountyHunters.jpg',
'/sw-test/gallery/myLittleVader.jpg',
'/sw-test/gallery/snowTroopers.jpg',
+ ...lotList,
])
);
});
step: step1: add 1000 image, step2: tick ‘update on reload’ step3: reload Then, the above problem will recur