Skip to content

Commit 02f1249

Browse files
committed
refactor: update status command to get branches previous release in parallel
1 parent dfa937e commit 02f1249

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

lib/commands/status.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,14 +173,23 @@ Clone wiki: ${ ansi.hl( upstream.wikiSshCloneUrl ) }
173173
},
174174
} );
175175

176+
await Promise.all( Object.keys( status.branchStatus ).map( branchName =>
177+
pkg.git
178+
.getPreviousRelease( {
179+
"commitRef": branchName,
180+
} )
181+
.then( res => {
182+
status.branchStatus[ branchName ].previousRelease = res;
183+
} ) ) );
184+
176185
for ( const branchName of Object.keys( status.branchStatus ).sort( pkg.git.compareBranches ) ) {
177-
const res = await pkg.git.getPreviousRelease( { "commitRef": branchName } );
186+
const previousRelease = status.branchStatus[ branchName ].previousRelease;
178187

179188
table.write( {
180189
branchName,
181190
"syncStatus": status.branchStatus[ branchName ],
182-
"previousRelease": res.data,
183-
"unreleasedCommits": res.data,
191+
"previousRelease": previousRelease.data,
192+
"unreleasedCommits": previousRelease.data,
184193
} );
185194
}
186195

0 commit comments

Comments
 (0)