tools/PTE/pte-snapshot.js
/**
 * poll snapshot generating or generated timestamp
 *
 * @param {string} cmd The generating or generated command
 * @returns {object} The object contains the timestamp and status
 */
poll snapshot generating or generated timestamp
@param {string} cmd The generating or generated command
@returns {object} The object contains the timestamp and status
poll snapshot generating or generated timestamp @param { string } cmd The generating or generated command @returns { object } The object contains the timestamp and status
async function pollTimestamp(cmd) {
    let t = 0;
    let str;
    let cmdStatus = true;
    try {
        str = (await child_process.execSync(cmd)).toString();
        if (str.includes('[34m')) {
            str = str.substr(str.indexOf('[34m')+4);
        }
        t = str.substr(0, str.indexOf('[kvledger]')-1);
        t = new Date(t).getTime();
    } catch(error) {
        logger.warn('[pollTimestamp] command (%s) failed', cmd);
        cmdStatus = false;
    }
    return {t, cmdStatus};
}
async function pollTimestamp ( cmd ) { let t = 0 ; let str ; let cmdStatus = true ; try { str = ( await child_process . execSync ( cmd ) ) . toString ( ) ; if ( str . includes ( '[34m' ) ) { str = str . substr ( str . indexOf ( '[34m' ) + 4 ) ; } t = str . substr ( 0 , str . indexOf ( '[kvledger]' ) - 1 ) ; t = new Date ( t ) . getTime ( ) ; } catch ( error ) { logger . warn ( '[pollTimestamp] command (%s) failed' , cmd ) ; cmdStatus = false ; } return { t , cmdStatus } ; }
poll snapshot generating or generated timestamp
 @param {string} cmd The generating or generated command
 @returns {object} The object contains the timestamp and status
poll snapshot generating or generated timestamp @param { string } cmd The generating or generated command @returns { object } The object contains the timestamp and status