File tree 1 file changed +4
-3
lines changed
1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -11,27 +11,28 @@ try {
11
11
worksmith . use ( "lodash" , worksmith . createAdapter ( require ( 'lodash' ) ) )
12
12
var workflow = worksmith ( "./stress-test/stress-workflows/workflow1.js" )
13
13
console . log ( 'About to execute workflow1' )
14
- calculateAverageExecTime ( function ( average ) {
14
+ calculateAverageExecTime ( workflow , function ( average ) {
15
15
console . log ( 'The average execution time is: ' , average , ' ms' )
16
16
} )
17
17
} catch ( e ) {
18
18
console . error ( 'There was an error setting up a workflow: ' , e )
19
19
}
20
20
21
- function calculateAverageExecTime ( next ) {
21
+ function calculateAverageExecTime ( workflow , next ) {
22
22
var average = counter = 0
23
23
async . whilst (
24
24
function ( ) { return counter < SAMPLE_SIZE } ,
25
25
function ( cb ) {
26
26
counter ++ ;
27
27
var ctx = { }
28
28
workflow ( ctx , function ( err , results ) {
29
- if ( err ) console . error ( 'There was an error running a workflow: ' , err . toString ( ) )
29
+ if ( err ) return cb ( err )
30
30
average += ctx . duration
31
31
cb ( )
32
32
} )
33
33
} ,
34
34
function ( err ) {
35
+ if ( err ) console . error ( 'There was an error running a workflow: ' , err . toString ( ) )
35
36
next ( average / SAMPLE_SIZE )
36
37
}
37
38
)
You can’t perform that action at this time.
0 commit comments