MCPcopy Index your code
hub / github.com/OpenSIST/OpenSIST.github.io / prefetchProfiles

Function prefetchProfiles

src/Data/CoreCacheSync.js:86–102  ·  view source on GitHub ↗
(applicants, syncEpoch)

Source from the content-addressed store, hash-verified

84}
85
86async 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
104async function syncCoreCache() {
105 if (syncRunning || !navigator.onLine) {

Callers 1

syncCoreCacheFunction · 0.85

Calls 8

getDisplayNameFunction · 0.90
getMetadataBatchFunction · 0.90
getAvatarFunction · 0.90
waitForIdleFunction · 0.85
loadSafelyFunction · 0.85
shouldContinueFunction · 0.85
prefetchInBatchesFunction · 0.85

Tested by

no test coverage detected