src/comm/client/local-client.js
/**
 * Perform test with specified test duration
 * @param {JSON} msg start test message
 * @param {Object} cb callback module
 * @param {Object} context blockchain context
 * @return {Promise} promise object
 */
Perform test with specified test duration
@param {JSON} msg start test message
@param {Object} cb callback module
@param {Object} context blockchain context
@return {Promise} promise object
Perform test with specified test duration @param { JSON } msg start test message @param { Object } cb callback module @param { Object } context blockchain context @return { Promise } promise object
async function runDuration(msg, cb, context) {
    log('Info: client ' + process.pid +  ' start test runDuration()' + (cb.info ? (':' + cb.info) : ''));
    let rateControl = new RateControl(msg.rateControl, blockchain);
    rateControl.init(msg);
    const duration = msg.txDuration; 
    await cb.init(blockchain, context, msg.args);
    startTime = Date.now();
    let promises = [];
    while ((Date.now() - startTime)/1000 < duration) {
        promises.push(cb.run().then((result) => {
            addResult(result);
            return Promise.resolve();
        }));
        await rateControl.applyRateControl(startTime, txNum, results, resultStats);
    }
    blockchain.finishIssueTxn();
    await Promise.all(promises);
    await rateControl.end();
    return await blockchain.releaseContext(context);
}
async function runDuration ( msg , cb , context ) { log ( 'Info: client ' + process . pid + ' start test runDuration()' + ( cb . info ? ( ':' + cb . info ) : '' ) ) ; let rateControl = new RateControl ( msg . rateControl , blockchain ) ; rateControl . init ( msg ) ; const duration = msg . txDuration ; await cb . init ( blockchain , context , msg . args ) ; startTime = Date . now ( ) ; let promises = [ ] ; while ( ( Date . now ( ) - startTime ) / 1000 < duration ) { promises . push ( cb . run ( ) . then ( ( result ) => { addResult ( result ) ; return Promise . resolve ( ) ; } ) ) ; await rateControl . applyRateControl ( startTime , txNum , results , resultStats ) ; } blockchain . finishIssueTxn ( ) ; await Promise . all ( promises ) ; await rateControl . end ( ) ; return await blockchain . releaseContext ( context ) ; }
Perform test with specified test duration
 @param {JSON} msg start test message
 @param {Object} cb callback module
 @param {Object} context blockchain context
 @return {Promise} promise object
Perform test with specified test duration @param { JSON } msg start test message @param { Object } cb callback module @param { Object } context blockchain context @return { Promise } promise object
// duration in seconds