refactor: use await for cache open in ximg-worker
Signed-off-by: Varun Patil <radialapps@gmail.com>pull/672/head
parent
10ff01ae86
commit
6b2e462496
|
@ -22,12 +22,13 @@ const pendingUrls = new Map<string, BlobCallback[]>();
|
|||
// Cache for preview images
|
||||
const cacheName = 'images';
|
||||
let imageCache: Cache;
|
||||
self.caches
|
||||
?.open(cacheName)
|
||||
.then((c) => (imageCache = c))
|
||||
.catch((e) => {
|
||||
console.warn('Failed to open cache in worker', e);
|
||||
});
|
||||
(async function openCache() {
|
||||
try {
|
||||
imageCache = await self.caches?.open(cacheName);
|
||||
} catch {
|
||||
console.warn('Failed to open cache in worker');
|
||||
}
|
||||
})();
|
||||
|
||||
// Expiration for cache
|
||||
const expirationManager = new CacheExpiration(cacheName, {
|
||||
|
|
Loading…
Reference in New Issue