perf(preload): bounded concurrency + drop redundant SW data cache

Fetch preload files with 6 workers in flight instead of one-at-a-time,
preserving retry/404/circuit-breaker/IDB-write-failure semantics. Browsers
already cap ~6 connections per origin, so this is safe and cuts a full
3431-file preload to roughly 1/5 the wall-clock time.

Remove the StaleWhileRevalidate routes for /data/*.json and /data/*.text.
IndexedDB is the canonical offline store (every data read falls back to it),
so the SW data caches only thrashed (200 entries over 3431 files) and added a
caches.match/cache.put to every request. Keep NetworkFirst for the manifest
and CacheFirst for fonts.
This commit is contained in:
catarrh committed 2026-11-02 22:03:56 +03:00
1 parent baf2baf65d
commit f3810fa8ef
2 files changed
+51 -40

No files matched your search

-16
View File
@@ -24,22 +24,6 @@ export default defineConfig({
networkTimeoutSeconds: 3,
},
},
{
urlPattern: /\/data\/.*\.json$/,
handler: 'StaleWhileRevalidate',
options: {
cacheName: 'ponomar-data',
expiration: { maxEntries: 200, maxAgeSeconds: 60 * 60 * 24 * 30 },
},
},
{
urlPattern: /\/data\/.*\.text$/,
handler: 'StaleWhileRevalidate',
options: {
cacheName: 'ponomar-bible',
expiration: { maxEntries: 100, maxAgeSeconds: 60 * 60 * 24 * 30 },
},
},
{
urlPattern: /\/fonts\/.*\.woff2?$/,
handler: 'CacheFirst',