()
| 102 | } |
| 103 | |
| 104 | async function syncCoreCache() { |
| 105 | if (syncRunning || !navigator.onLine) { |
| 106 | return; |
| 107 | } |
| 108 | syncRunning = true; |
| 109 | const syncEpoch = getCacheEpoch(); |
| 110 | try { |
| 111 | const {programs, applicants} = await prefetchCoreCache(); |
| 112 | if (!shouldContinue(syncEpoch)) { |
| 113 | return; |
| 114 | } |
| 115 | await prefetchProgramDescriptions(collectProgramIds(programs), syncEpoch); |
| 116 | await prefetchProfiles(applicants, syncEpoch); |
| 117 | } finally { |
| 118 | syncRunning = false; |
| 119 | if (active && syncEpoch !== getCacheEpoch()) { |
| 120 | scheduleSync(); |
| 121 | } |
| 122 | } |
| 123 | } |
| 124 | |
| 125 | function scheduleSync() { |
| 126 | if (!active || idleHandle !== null) { |
no test coverage detected