File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -100,7 +100,11 @@ async function runProducer(config: ProducerConfig) {
100100 } ) ;
101101
102102 try {
103- console . log ( `[Producer] Starting - will create ${ config . numRuns } runs (${ ( config . errorRate * 100 ) . toFixed ( 1 ) } % with errors)` ) ;
103+ console . log (
104+ `[Producer] Starting - will create ${ config . numRuns } runs (${ ( config . errorRate * 100 ) . toFixed (
105+ 1
106+ ) } % with errors)`
107+ ) ;
104108 const startTime = performance . now ( ) ;
105109 let created = 0 ;
106110 let withErrors = 0 ;
@@ -151,7 +155,9 @@ async function runProducer(config: ProducerConfig) {
151155 if ( batch % 10 === 0 || batch === Math . ceil ( config . numRuns / config . batchSize ) - 1 ) {
152156 const elapsed = performance . now ( ) - startTime ;
153157 const rate = ( created / elapsed ) * 1000 ;
154- console . log ( `[Producer] Progress: ${ created } /${ config . numRuns } runs (${ rate . toFixed ( 0 ) } runs/sec)` ) ;
158+ console . log (
159+ `[Producer] Progress: ${ created } /${ config . numRuns } runs (${ rate . toFixed ( 0 ) } runs/sec)`
160+ ) ;
155161 }
156162 }
157163
@@ -198,7 +204,8 @@ if (!configArg) {
198204 process . exit ( 1 ) ;
199205}
200206
201- const config : ProducerConfig = JSON . parse ( configArg ) ;
207+ // This is ok for a benchmark script, but not for production code.
208+ const config = JSON . parse ( configArg ) as ProducerConfig ;
202209runProducer ( config ) . catch ( ( error ) => {
203210 console . error ( "Fatal error:" , error ) ;
204211 process . exit ( 1 ) ;
You can’t perform that action at this time.
0 commit comments