Skip to content

Commit 13d910f

Browse files
committed
parallelize fetching of configs
1 parent 486964c commit 13d910f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/optimizer/build/downloadRuntimeParameters.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,8 @@ const JSON5 = require('json5');
4545
'https://raw.githubusercontent.com/ampproject/amphtml/main/build-system/compile/bundles.config.extensions.json';
4646
const latestVersionsUrl = `https://raw.githubusercontent.com/ampproject/amphtml/main/build-system/compile/bundles.legacy-latest-versions.jsonc`;
4747

48-
const configResponse = await fetch(extensionConfigUrl);
49-
const latestVersionsConfigResponse = await fetch(latestVersionsUrl);
50-
48+
const responses = await Promise.all([fetch(extensionConfigUrl), fetch(latestVersionsUrl)]);
49+
const [configResponse, latestVersionsConfigResponse] = responses;
5150
if (!configResponse.ok) {
5251
throw new Error(
5352
`Failed downloading ${extensionConfigUrl} with status ${configResponse.status}`
@@ -58,6 +57,7 @@ const JSON5 = require('json5');
5857
`Failed fetching latest component versions from ${latestVersionsUrl} with status: ${latestVersionsConfigResponse.status}`
5958
);
6059
}
60+
6161
const extensionConfig = await configResponse.json();
6262
const latestVersionsConfig = JSON5.parse(await latestVersionsConfigResponse.text());
6363
// We add back the "latestVersion" field so that the auto importer

0 commit comments

Comments
 (0)