this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix wrong "once" logic 🤦‍♂️

+3 -3
+3 -3
src/main.jsx
··· 52 52 if ('serviceWorker' in navigator && typeof caches !== 'undefined') { 53 53 const MAX_SW_CACHE_SIZE = 50; 54 54 const IGNORE_CACHE_KEYS = ['icons']; 55 - let clearedOnce = false; 55 + let clearRanOnce = false; 56 56 const FAST_INTERVAL = 10_000; // 10 seconds 57 57 const SLOW_INTERVAL = 60 * 60 * 1000; // 1 hour 58 58 async function clearCaches() { ··· 69 69 for (const deleteKey of deleteKeys) { 70 70 await cache.delete(deleteKey); 71 71 } 72 - clearedOnce = true; 73 72 } 74 73 } 74 + clearRanOnce = true; 75 75 } catch (e) {} // Silent fail 76 76 } 77 77 // Once cleared, clear again at slower interval 78 - setTimeout(clearCaches, clearedOnce ? SLOW_INTERVAL : FAST_INTERVAL); 78 + setTimeout(clearCaches, clearRanOnce ? SLOW_INTERVAL : FAST_INTERVAL); 79 79 } 80 80 setTimeout(clearCaches, FAST_INTERVAL); 81 81 }