tools/PTE/pte-main.js
/**
 * snapshot queryinfo handler
 *
 * @param {string} org The target organization name
 * @param {string} proc The child process to be terminated
 * @returns {Promise<void>}
 */
snapshot queryinfo handler
@param {string} org The target organization name
@param {string} proc The child process to be terminated
@returns {Promise}
snapshot queryinfo handler @param { string } org The target organization name @param { string } proc The child process to be terminated @returns { Promise }
async function snapshotHandler(org, proc) {
    const pteSnapshotPath = path.join(__dirname, 'pte-snapshot.js')
    snapshotProcess = child_process.spawn('node', [pteSnapshotPath, Nid, uiFile, PTEid]);
    snapshotPid.push(snapshotProcess.pid);
    logger.info('[pte-main:snapshotHandler] spawn off snapshot child process pid: %d', snapshotProcess.pid);
    logger.info('[pte-main:snapshotHandler] node %s %d %s %s %d', pteSnapshotPath, Nid, uiFile, PTEid);
    snapshotProcess.stdout.on('data', function (data) {
        logger.info('stdout: ' + data);
        if (data.indexOf("reach final block height:") > -1) {
            logger.info('snapshots are generated successfully, stop transaction proc');
            stopProcess(proc, 'transaction processes');
            process.exit(0);
        }
    });
    snapshotProcess.on('close', function (code) {
        logger.info('snapshotProcess closed, with code=', code);
    });
    snapshotProcess.on('exit', function (code, signal) {
        logger.info("snapshotProcess exited, with code= " + code + " and signal= " + signal);
        stopProcess(proc, 'transaction processes');
        process.exit(0);
    });
}
async function snapshotHandler ( org , proc ) { const pteSnapshotPath = path . join ( __dirname , 'pte-snapshot.js' ) snapshotProcess = child_process . spawn ( 'node' , [ pteSnapshotPath , Nid , uiFile , PTEid ] ) ; snapshotPid . push ( snapshotProcess . pid ) ; logger . info ( '[pte-main:snapshotHandler] spawn off snapshot child process pid: %d' , snapshotProcess . pid ) ; logger . info ( '[pte-main:snapshotHandler] node %s %d %s %s %d' , pteSnapshotPath , Nid , uiFile , PTEid ) ; snapshotProcess . stdout . on ( 'data' , function ( data ) { logger . info ( 'stdout: ' + data ) ; if ( data . indexOf ( "reach final block height:" ) > - 1 ) { logger . info ( 'snapshots are generated successfully, stop transaction proc' ) ; stopProcess ( proc , 'transaction processes' ) ; process . exit ( 0 ) ; } } ) ; snapshotProcess . on ( 'close' , function ( code ) { logger . info ( 'snapshotProcess closed, with code=' , code ) ; } ) ; snapshotProcess . on ( 'exit' , function ( code , signal ) { logger . info ( "snapshotProcess exited, with code= " + code + " and signal= " + signal ) ; stopProcess ( proc , 'transaction processes' ) ; process . exit ( 0 ) ; } ) ; }
snapshot queryinfo handler
 @param {string} org The target organization name
 @param {string} proc The child process to be terminated
 @returns {Promise<void>}
snapshot queryinfo handler @param { string } org The target organization name @param { string } proc The child process to be terminated @returns { Promise<void > }