angular-cn/packages/service-worker/worker
George Kalpakas cc30dc0713 fix(service-worker): ensure obsolete caches are always cleaned up (#42622)
Previously, the SW was only able to clean up caches for app-versions
found in the `Driver`'s `versions` map. If (for some reason) the
`Driver` failed to load a valid stored state (including app-versions)
and ended up with an [empty `versions` map][1], any obsolete versions
would remain in the cache storage. This case was rare but possible.

This commit makes the cache clean-up logic more robust by ensuring that
all app-version caches are removed unless they are currently used by the
SW to serve active clients (with the exception of the latest
app-version, which is always retained).

Fixes #41728

[1]: 9de65dbdce/packages/service-worker/worker/src/driver.ts (L515-L529)

PR Close #42622
2021-06-24 09:55:32 -07:00
..
src fix(service-worker): ensure obsolete caches are always cleaned up (#42622) 2021-06-24 09:55:32 -07:00
test fix(service-worker): ensure obsolete caches are always cleaned up (#42622) 2021-06-24 09:55:32 -07:00
testing refactor(service-worker): simplify accessing `CacheStorage` throughout the ServiceWorker (#42622) 2021-06-24 09:55:32 -07:00
BUILD.bazel build: enable service-worker tests on saucelabs (#36129) 2020-04-01 15:37:47 -07:00
main.ts refactor(service-worker): simplify accessing `CacheStorage` throughout the ServiceWorker (#42622) 2021-06-24 09:55:32 -07:00