A music player that connects to your cloud/distributed storage.

chore: throttle processing facet by 10 minutes

+22 -4
+1 -1
src/_data/facets.json
··· 41 41 "kind": "prelude", 42 42 "category": "Data", 43 43 "featured": true, 44 - "desc": "Process all your audio inputs automatically when opening any interface." 44 + "desc": "Process all your audio inputs automatically when opening any interface. Happens once every 10 minutes." 45 45 }, 46 46 { 47 47 "url": "facets/misc/scrobble/index.html",
+21 -3
src/facets/data/process-tracks/index.inline.js
··· 1 1 import foundation from "~/common/foundation.js"; 2 2 3 - foundation.orchestrator.processTracks({ 4 - disableWhenReady: false, 5 - }); 3 + const KEY = "facets/data/process-tracks/timestamp"; 4 + const lastTimestamp = localStorage.getItem(KEY); 5 + const now = Date.now(); 6 + 7 + if (lastTimestamp) { 8 + const diff = now - JSON.parse(lastTimestamp); 9 + 10 + if (diff >= 10 * 60 * 1000) { 11 + foundation.orchestrator.processTracks({ 12 + disableWhenReady: false, 13 + }); 14 + 15 + localStorage.setItem(KEY, JSON.stringify(now)); 16 + } 17 + } else { 18 + foundation.orchestrator.processTracks({ 19 + disableWhenReady: false, 20 + }); 21 + 22 + localStorage.setItem(KEY, JSON.stringify(now)); 23 + }