Skip to content

Commit 94950ec

Browse files
committed
Keep the original logic and fetch in parallel
1 parent a015d80 commit 94950ec

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

src/lib/mina/v1/fetch.ts

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -371,15 +371,18 @@ async function fetchMissingData(graphqlEndpoint: string, archiveEndpoint?: strin
371371
if (network !== undefined) {
372372
promises.push(
373373
(async () => {
374-
try {
375-
await fetchLastBlock(graphqlEndpoint);
376-
} catch {}
377-
378-
try {
379-
await fetchGenesisConstants(graphqlEndpoint);
380-
} catch {}
381-
382-
delete networksToFetch[network[0]];
374+
const [lastBlockOk, genesisOk] = await Promise.all([
375+
fetchLastBlock(graphqlEndpoint)
376+
.then(() => true)
377+
.catch(() => false),
378+
fetchGenesisConstants(graphqlEndpoint)
379+
.then(() => true)
380+
.catch(() => false),
381+
]);
382+
383+
if (lastBlockOk && genesisOk) {
384+
delete networksToFetch[network[0]];
385+
}
383386
})()
384387
);
385388
}

0 commit comments

Comments
 (0)