Automattic / vip-cli

The VIP-CLI
https://docs.wpvip.com/vip-cli/
MIT License
58 stars 17 forks source link

Multiple environments slow down Lando #2027

Closed sjinks closed 2 months ago

sjinks commented 2 months ago
for i in $(seq 0 9); do vip dev-env create --slug s${i} < /dev/null; done
diff --git a/src/lib/dev-environment/dev-environment-core.ts b/src/lib/dev-environment/dev-environment-core.ts
index 300445f5..4558e655 100644
--- a/src/lib/dev-environment/dev-environment-core.ts
+++ b/src/lib/dev-environment/dev-environment-core.ts
@@ -297,8 +297,11 @@ export async function printAllEnvironmentsInfo(
        for ( const envName of allEnvNames ) {
                try {
                        console.log( '\n' );
+                       const start = Date.now();
                        // eslint-disable-next-line no-await-in-loop
                        await printEnvironmentInfo( lando, envName, options );
+                       const duration = Date.now() - start;
+                       console.log( chalk.gray( `Duration for ${ envName }: ${ duration }ms` ) );
                } catch ( error ) {
                        if ( error instanceof UserError ) {
                                console.warn( '\nWARNING: "%s" is not a valid environment\n', envName );
% vip dev-env list | grep Duration
Duration for s0: 673ms
Duration for s1: 567ms
Duration for s2: 603ms
Duration for s3: 637ms
Duration for s4: 777ms
Duration for s5: 917ms
Duration for s6: 1315ms
Duration for s7: 2190ms
Duration for s8: 4629ms
Duration for s9: 10579ms