(url, timeoutMs)
| 906 | return 2500; |
| 907 | } |
| 908 | function _runCount(url, timeoutMs) { |
| 909 | return new Promise(resolve => { |
| 910 | const start = () => { |
| 911 | _activeCountReqs++; |
| 912 | fetchJSONWithTimeout(url, timeoutMs || 2500) |
| 913 | .then(resolve) |
| 914 | .finally(() => { |
| 915 | _activeCountReqs--; |
| 916 | const next = _countReqQueue.shift(); |
| 917 | if (next) next(); |
| 918 | }); |
| 919 | }; |
| 920 | if (_activeCountReqs < MAX_CONCURRENT_COUNT_REQS) start(); |
| 921 | else _countReqQueue.push(start); |
| 922 | }); |
| 923 | } |
| 924 | function scheduleFolderStatsWork(fn, timeoutMs = 700) { |
| 925 | if (typeof requestIdleCallback === 'function') { |
| 926 | requestIdleCallback(() => { try { fn(); } catch (e) {} }, { timeout: timeoutMs }); |
no test coverage detected