Financial-Times / n-service-worker

❌ DECOMMISSIONED Global service worker component for next.ft.com
5 stars 2 forks source link

Improve the cleanup of old caches #144

Closed sjparkinson closed 6 years ago

sjparkinson commented 6 years ago

v2 of #142

Moves cache clearing from install to activate so that it works as expected.

wheresrhys commented 6 years ago

I'm interested to know what 'as expected' means? What's the difference in behaviour between install and activated?

sjparkinson commented 6 years ago

So #142 is released to QA and in giving it a spin I saw that it wasn't clearing up all caches.

I narrowed it down to the timing difference between these events.

First is installed then is activated, but before the latter and after the former the previous service worker is still running? and can open/create caches, install then won't happen again for a day.

I think eventually it would cleanup but it didn't feel correct / as I'd expect.

wheresrhys commented 6 years ago

:+1::+1::+1: