How to use the @hyperledger/caliper-core.CaliperUtils.sleep function in @hyperledger/caliper-core

To help you get started, we’ve selected a few @hyperledger/caliper-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hyperledger / caliper / packages / caliper-iroha / lib / iroha.js View on Github external
async init() {
        // TODO: How to judge Iroha service's status elegantly?
        return CaliperUtils.sleep(10000); // Wait for Iroha network to start up
    }
github hyperledger / caliper / packages / caliper-composer / lib / composer_utils.js View on Github external
let spinner = ora('Joining peers to channels').start();
                try {
                    await runCommand(fetchCmd);
                    const attempts = 5; // The join process can fail if couchDB is being used, so condition for that here
                    for (let i = 0; i
github hyperledger / caliper / packages / caliper-fabric / lib / fabric.js View on Github external
async installSmartContract() {
        // With flow conditioning, this phase is conditionally required
        if (!this.initPhaseCompleted ) {
            await this._initializeRegistrars(true);
            await this._initializeAdmins(true);
            await this._initializeUsers(true);
        }

        await this._installChaincodes();
        if (await this._instantiateChaincodes()) {
            logger.info(`Sleeping ${this.configSleepAfterInstantiateChaincode / 1000.0}s...`);
            await CaliperUtils.sleep(this.configSleepAfterInstantiateChaincode);
        }
    }
github hyperledger / caliper / packages / caliper-fabric / lib / fabric.js View on Github external
async init() {
        let tlsInfo = this.networkUtil.isMutualTlsEnabled() ? 'mutual'
            : (this.networkUtil.isTlsEnabled() ? 'server' : 'none');
        let compMode = this.networkUtil.isInCompatibilityMode() ? '; Fabric v1.0 compatibility mode' : '';
        logger.info(`Fabric SDK version: ${this.version.toString()}; TLS: ${tlsInfo}${compMode}`);

        await this._initializeRegistrars(true);
        await this._initializeAdmins(true);
        await this._initializeUsers(true);
        this.initPhaseCompleted = true;

        if (await this._createChannels()) {
            logger.info(`Sleeping ${this.configSleepAfterCreateChannel / 1000.0}s...`);
            await CaliperUtils.sleep(this.configSleepAfterCreateChannel);
        }

        if (await this._joinChannels()) {
            logger.info(`Sleeping ${this.configSleepAfterJoinChannel / 1000.0}s...`);
            await CaliperUtils.sleep(this.configSleepAfterJoinChannel);
        }
    }
github hyperledger / caliper / packages / caliper-fisco-bcos / lib / fiscoBcosApi.js View on Github external
}).catch(async (reason) => {
        await CaliperUtils.sleep(2000);
        updateCurrentBlockNumber(networkConfig);
    });
}
github hyperledger / caliper / packages / caliper-fabric / lib / fabric.js View on Github external
let compMode = this.networkUtil.isInCompatibilityMode() ? '; Fabric v1.0 compatibility mode' : '';
        logger.info(`Fabric SDK version: ${this.version.toString()}; TLS: ${tlsInfo}${compMode}`);

        await this._initializeRegistrars(true);
        await this._initializeAdmins(true);
        await this._initializeUsers(true);
        this.initPhaseCompleted = true;

        if (await this._createChannels()) {
            logger.info(`Sleeping ${this.configSleepAfterCreateChannel / 1000.0}s...`);
            await CaliperUtils.sleep(this.configSleepAfterCreateChannel);
        }

        if (await this._joinChannels()) {
            logger.info(`Sleeping ${this.configSleepAfterJoinChannel / 1000.0}s...`);
            await CaliperUtils.sleep(this.configSleepAfterJoinChannel);
        }
    }
github hyperledger / caliper / packages / caliper-sawtooth / lib / sawtooth.js View on Github external
async function getBatchEventResponse(batchID, batchStats, timeout) {
    try {
        const beforeTime = Date.now();
        while(batchCommitStatus.get(batchID) === 'pending') {
            if((Date.now() - beforeTime) > timeout) {
                throw new Error('Timeout, batchID: ' + batchID);
            }
            await CaliperUtils.sleep(200);
        }
        batchStats.SetStatusSuccess();
        return batchStats;
    } catch(err){
        logger.info('getBatchEventResponse err: ' + err);
        batchStats.SetStatusFail();
        return batchStats;
    }
}
github hyperledger / caliper / packages / caliper-sawtooth / lib / sawtooth.js View on Github external
.then(decoded => {
            const status = _.findKey(ClientEventsUnsubscribeResponse.Status,
                val => val === decoded.status);
            if (status !== 'OK') {
                throw new Error(`Validator responded with status "${status}"`);
            }
            stream1.close();
            return CaliperUtils.sleep(1000);
        });
}