We've started using CacheStorage API. Generally it works fine, but sometimes browser gets into a situation where CacheStorage promises never respond (i.e. they neither resolve nor reject).
Once I get into the situation I can reproduce it 100% on a first call like:
let promise = caches.open("TestDB");
console.log("open - started");
promise
.then(cc => console.log("open - complete"))
.catch(ex => console.log("open - failed", ex));
console.log("open - waiting");
In the sample code it will print:
open - started
open - waiting
but never the other two logs.
Any ideas why would this happen? and how to address the issue?
If I open a private tab, then it works fine. Clearing the cache from UI solves the problem too.
This has been reproduced on Chrome and Safari.
We've seen other situations where open
call succeeds, but then match
fails (i.e. doesn't resolve) randomly, i.e. it seems to depend on the number of requests to the cache, as adding console.log
seems to make the problem less frequent.