16073: Parallelize process output requests
[arvados-workbench2.git] / src / store / process-panel / process-panel-actions.ts
index d21b9b83d0669108b2bf017b72bb43cb44cfb9c4..c8c0bcc77d34c4d5a4ebcf32f6df7af1bf4e74a7 100644 (file)
@@ -49,8 +49,10 @@ export const navigateToOutput = (uuid: string) =>
 export const loadOutputs = (uuid: string, setOutputs) =>
     async (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
         try {
-            const files = await services.collectionService.files(uuid);
-            const collection = await services.collectionService.get(uuid);
+            const filesPromise = services.collectionService.files(uuid);
+            const collectionPromise = services.collectionService.get(uuid);
+            const [files, collection] = await Promise.all([filesPromise, collectionPromise]);
+
             const outputFile = files.find((file) => file.name === 'cwl.output.json') as CollectionFile | undefined;
             let outputData = outputFile ? await services.collectionService.getFileContents(outputFile) : undefined;
             if ((outputData = JSON.parse(outputData)) && collection.portableDataHash) {