(applicants, syncEpoch)
| 84 | } |
| 85 | |
| 86 | async function prefetchProfiles(applicants, syncEpoch) { |
| 87 | await waitForIdle(syncEpoch); |
| 88 | const displayName = await loadSafely(() => getDisplayName(false, {priority: BACKGROUND_PRIORITY})); |
| 89 | if (!shouldContinue(syncEpoch)) { |
| 90 | return; |
| 91 | } |
| 92 | const currentMetadata = displayName |
| 93 | ? await loadSafely(() => getMetadataBatch([displayName], false, {priority: BACKGROUND_PRIORITY})) |
| 94 | : null; |
| 95 | const displayNames = collectProfileDisplayNames(displayName, currentMetadata?.[displayName], applicants); |
| 96 | await prefetchInBatches(displayNames, PROFILE_BATCH_SIZE, syncEpoch, async (batch) => { |
| 97 | const metadataByName = await getMetadataBatch(batch, false, {priority: BACKGROUND_PRIORITY}); |
| 98 | await Promise.all(batch.map((displayName) => loadSafely(() => ( |
| 99 | getAvatar(metadataByName[displayName]?.Avatar, displayName, false, {priority: BACKGROUND_PRIORITY}) |
| 100 | )))); |
| 101 | }); |
| 102 | } |
| 103 | |
| 104 | async function syncCoreCache() { |
| 105 | if (syncRunning || !navigator.onLine) { |
no test coverage detected