@@ -2,6 +2,7 @@ import { Command, flags } from '@oclif/command';
22
33import { log } from './logger' ;
44import { handleFlags } from './cli' ;
5+ import { getElapsedTime } from './util/ts' ;
56import SyncResult from './domain/SyncResult' ;
67import SyncParams from './domain/SyncParams' ;
78import { printError , printLine } from './util/io' ;
@@ -35,11 +36,11 @@ class SyncDb extends Command {
3536 ...userParams ,
3637 // Individual success handler
3738 onSuccess : ( context : ExecutionContext ) =>
38- printLine ( ` [✓] ${ context . connectionId } - Successful (${ context . timeElapsed . toFixed ( 2 ) } s)` ) ,
39+ printLine ( ` [✓] ${ context . connectionId } - Successful (${ context . timeElapsed } s)` ) ,
3940
4041 // Individual error handler
4142 onFailed : ( context : ExecutionContext ) =>
42- printLine ( ` [✖] ${ context . connectionId } - Failed (${ context . timeElapsed . toFixed ( 2 ) } s)` )
43+ printLine ( ` [✖] ${ context . connectionId } - Failed (${ context . timeElapsed } s)` )
4344 } ;
4445 }
4546
@@ -61,11 +62,20 @@ class SyncDb extends Command {
6162 const config = await loadConfig ( ) ;
6263 const connections = await resolveConnections ( ) ;
6364 const { synchronize } = await import ( './api' ) ;
65+ const timeStart = process . hrtime ( ) ;
6466
6567 await printLine ( 'Synchronizing...\n' ) ;
6668
6769 const results = await synchronize ( config , connections , params ) ;
68- const { totalCount, failedCount } = await this . processResults ( results ) ;
70+ const { totalCount, failedCount, successfulCount } = await this . processResults ( results ) ;
71+
72+ if ( successfulCount > 0 ) {
73+ // Display output.
74+ await printLine (
75+ `Synchronization complete for ${ successfulCount } / ${ totalCount } connection(s). ` +
76+ `(${ getElapsedTime ( timeStart ) } s)`
77+ ) ;
78+ }
6979
7080 // If all completed successfully, exit gracefully.
7181 if ( failedCount === 0 ) {
@@ -101,11 +111,6 @@ class SyncDb extends Command {
101111
102112 await printLine ( ) ;
103113
104- if ( successfulCount > 0 ) {
105- // Display output.
106- await printLine ( `Synchronization successful for ${ successfulCount } / ${ totalCount } connection(s).` ) ;
107- }
108-
109114 // If there are errors, display all of them.
110115 if ( ! allComplete ) {
111116 await printLine ( `Synchronization failed for ${ failedCount } connection(s):\n` ) ;
0 commit comments