Interactive interface for browsing global, full-resolution satellite imagery
Improve file fetching at build time (#4499)
Patrick Moulden89ad6eee5763
diff --git a/tasks/build-options/getCapabilities.js b/tasks/build-options/getCapabilities.jsindex 8ff825ab7..b2d31943d 100644--- a/tasks/build-options/getCapabilities.js+++ b/tasks/build-options/getCapabilities.js@@ -64,13 +64,18 @@ async function getCapabilities () {// Download each GC xml using the "from" attribute and put it in the "to" locationif (Object.prototype.hasOwnProperty.call(config, 'wv-options-fetch')) {const fetchValues = config['wv-options-fetch']- for (const value of fetchValues) {+ // Perform fetchConfigs and processGetCapabilities seperately so that each batch can be done in parallel+ await Promise.all(fetchValues.map(async (value) => {const inputFile = value.fromconst outputFile = `${outputDir}/${value.to}`- await fetchConfigs(inputFile, outputFile)- await processGetCapabilities(outputFile)- }+ return fetchConfigs(inputFile, outputFile)+ }))+ await Promise.all(fetchValues.map(async (value) => {+ const outputFile = `${outputDir}/${value.to}`++ return processGetCapabilities(outputFile)+ }))}}@@ -173,9 +178,9 @@ async function gatherProcess (type, typeStr, dir, ext) {if (!fs.existsSync(dir)) {fs.mkdirSync(dir)}- Object.values(type).forEach(async (link) => {- await processMetadata(link, dir, ext)- })+ await Promise.all(Object.values(type).map((link) => {+ return processMetadata(link, dir, ext)+ }))}main().catch((err) => {diff --git a/tasks/build-options/getVisMetadata.js b/tasks/build-options/getVisMetadata.jsindex 6c2433138..17582bcf2 100644--- a/tasks/build-options/getVisMetadata.js+++ b/tasks/build-options/getVisMetadata.js@@ -85,9 +85,9 @@ async function main (url) {layerOrder = layerOrder.filter(x => !skipLayers.includes(x))console.warn(`${prog}: Fetching ${layerOrder.length} layer-metadata files`)- for (layerId of layerOrder) {- await getMetadata(layerId, url)- }+ await Promise.all(layerOrder.map((layerId) => {+ return getMetadata(layerId, url)+ }))const layers = Object.keys(layerMetadata).sort().reduce((obj, key) => {