/// Run test transactions continuously, handling errors by incrementing
/// prometheus counters
///
/// Arguments:
/// * period: The amount of time we wait between test transfers
Run test transactions continuously, handling errors by incrementing
prometheus counters

The amount of time we wait between test transfers
Run test transactions continuously handling errors by incrementing prometheus counters The amount of time we wait between test transfers
pub fn run_continuously(&self, period: Duration) {
        let client_count = self.account_keys.len() as usize;
        assert!(client_count > 1);
        log::debug!(self.logger, "Creating {} clients", client_count);
        let clients = self.build_clients(client_count);
        log::debug!(self.logger, "Generating and testing transactions");
        let mut ti = 0usize;
        loop {
            log::debug!(self.logger, "Transaction: {:?}", ti);
            let source_index = ti % client_count;
            let target_index = (ti + 1) % client_count;
            let source_client = clients[source_index].clone();
            let target_client = clients[target_index].clone();
            match self.test_transfer(source_client, source_index, target_client, target_index) {
                Ok(_) => {
                    log::info!(self.logger, "Transfer succeeded");
                    counters::TX_SUCCESS_COUNT.inc();
                }
                Err(err) => {
                    log::error!(self.logger, "Transfer failed: {}", err);
                    counters::TX_FAILURE_COUNT.inc();
                    match err {
                        TestClientError::ZeroBalance => {
                            counters::ZERO_BALANCE_COUNT.inc();
                        }
                        TestClientError::TxExpired => {
                            counters::TX_EXPIRED_COUNT.inc();
                        }
                        TestClientError::SubmittedTxTimeout => {
                            counters::CONFIRM_TX_TIMEOUT_COUNT.inc();
                        }
                        TestClientError::TxTimeout => {
                            counters::RECEIVE_TX_TIMEOUT_COUNT.inc();
                        }
                        TestClientError::BadBalance(_, _) => {
                            counters::BAD_BALANCE_COUNT.inc();
                        }
                        TestClientError::DoubleSpend => {
                            counters::TX_DOUBLE_SPEND_COUNT.inc();
                        }
                        TestClientError::UnexpectedMemo => {
                            counters::TX_UNEXPECTED_MEMO_COUNT.inc();
                        }
                        TestClientError::InvalidMemo => {
                            counters::TX_INVALID_MEMO_COUNT.inc();
                        }
                        TestClientError::CheckBalance(_) => {
                            counters::CHECK_BALANCE_ERROR_COUNT.inc();
                        }
                        TestClientError::BuildTx(_) => {
                            counters::BUILD_TX_ERROR_COUNT.inc();
                        }
                        TestClientError::SubmitTx(_) => {
                            counters::SUBMIT_TX_ERROR_COUNT.inc();
                        }
                        TestClientError::ConfirmTx(_) => {
                            counters::CONFIRM_TX_ERROR_COUNT.inc();
                        }
                    }
                }
            }
            ti += 1;
            std::thread::sleep(period);
        }
    }
pub fn run_continuously ( & self , period : Duration ) { let client_count = self . account_keys . len ( ) as usize ; assert ! ( client_count 1 ) ; log :: debug ! ( self logger " " client_count ) ; let clients = self . build_clients ( client_count ) ; log :: debug ! ( self logger " " ) ; let mut ti = 0usize ; loop { log :: debug ! ( self logger " " ti ) ; let source_index = ti % client_count ; let target_index = ( ti + 1 ) % client_count ; let source_client = clients [ source_index ] . clone ( ) ; let target_client = clients [ target_index ] . clone ( ) ; match self . test_transfer ( source_client , source_index , target_client , target_index ) { Ok ( _ ) => { log :: info ! ( self logger " " ) ; counters :: TX_SUCCESS_COUNT . inc ( ) ; } Err ( err ) => { log :: error ! ( self logger " " err ) ; counters :: TX_FAILURE_COUNT . inc ( ) ; match err { TestClientError :: ZeroBalance => { counters :: ZERO_BALANCE_COUNT . inc ( ) ; } TestClientError :: TxExpired => { counters :: TX_EXPIRED_COUNT . inc ( ) ; } TestClientError :: SubmittedTxTimeout => { counters :: CONFIRM_TX_TIMEOUT_COUNT . inc ( ) ; } TestClientError :: TxTimeout => { counters :: RECEIVE_TX_TIMEOUT_COUNT . inc ( ) ; } TestClientError :: BadBalance ( _ , _ ) => { counters :: BAD_BALANCE_COUNT . inc ( ) ; } TestClientError :: DoubleSpend => { counters :: TX_DOUBLE_SPEND_COUNT . inc ( ) ; } TestClientError :: UnexpectedMemo => { counters :: TX_UNEXPECTED_MEMO_COUNT . inc ( ) ; } TestClientError :: InvalidMemo => { counters :: TX_INVALID_MEMO_COUNT . inc ( ) ; } TestClientError :: CheckBalance ( _ ) => { counters :: CHECK_BALANCE_ERROR_COUNT . inc ( ) ; } TestClientError :: BuildTx ( _ ) => { counters :: BUILD_TX_ERROR_COUNT . inc ( ) ; } TestClientError :: SubmitTx ( _ ) => { counters :: SUBMIT_TX_ERROR_COUNT . inc ( ) ; } TestClientError :: ConfirmTx ( _ ) => { counters :: CONFIRM_TX_ERROR_COUNT . inc ( ) ; } } } } ti += 1 ; std :: thread :: sleep ( period ) ; } }
Run test transactions continuously, handling errors by incrementing
prometheus counters
Run test transactions continuously handling errors by incrementing prometheus counters
&self
period
Duration