Skip to content

Commit 4ef30c0

Browse files
committed
feat: Parallelized imports
1 parent bc21f23 commit 4ef30c0

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/orchestrators/import.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,22 +65,22 @@ export class ImportOrchestrator {
6565
...noPrompt.map((info) => new ResourceConfig({ type: info.type })),
6666
...userSupplied
6767
]
68-
const importResult = await ImportOrchestrator.getImportedConfigs(pluginManager, typeIds, valuesToImport)
68+
const importResult = await ImportOrchestrator.getImportedConfigs(pluginManager, valuesToImport)
6969

7070
ctx.processFinished(ProcessName.IMPORT)
7171
reporter.displayImportResult(importResult);
7272
}
7373

7474
static async getImportedConfigs(
7575
pluginManager: PluginManager,
76-
typeIds: string[],
7776
resources: ResourceConfig[],
7877
): Promise<ImportResult> {
79-
const importedConfigs = [];
80-
const errors = [];
78+
const importedConfigs: ResourceConfig[] = [];
79+
const errors: string[] = [];
8180

82-
for (const resource of resources) {
81+
await Promise.all(resources.map(async (resource) => {
8382
ctx.subprocessStarted(SubProcessName.IMPORT_RESOURCE, resource.type);
83+
8484
try {
8585
const response = await pluginManager.importResource(resource.toJson());
8686

@@ -97,7 +97,7 @@ export class ImportOrchestrator {
9797
}
9898

9999
ctx.subprocessFinished(SubProcessName.IMPORT_RESOURCE, resource.type);
100-
}
100+
}))
101101

102102
return {
103103
result: importedConfigs,

0 commit comments

Comments
 (0)