mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-14 22:01:20 +00:00
Make code smell better
This commit is contained in:
@ -102,19 +102,6 @@ Examples:
|
||||
)
|
||||
|
||||
// Wait until transacters have begun until we get the start time
|
||||
for {
|
||||
started := true
|
||||
for _, t := range transacters {
|
||||
for i := 0; i < t.Connections; i++ {
|
||||
if !t.connsStarted[i] && !t.connsBroken[i] {
|
||||
started = false
|
||||
}
|
||||
}
|
||||
}
|
||||
if started {
|
||||
break
|
||||
}
|
||||
}
|
||||
timeStart := time.Now()
|
||||
logger.Info("Time last transacter started", "t", timeStart)
|
||||
|
||||
@ -270,6 +257,11 @@ func startTransacters(
|
||||
transacters[i] = t
|
||||
}
|
||||
|
||||
// Wait until all transacters have started firing txs
|
||||
for _, t := range transacters {
|
||||
t.WaitUntilAllConnectionsStartedFiringTxs()
|
||||
}
|
||||
|
||||
return transacters
|
||||
}
|
||||
|
||||
|
@ -86,6 +86,22 @@ func (t *transacter) Start() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// WaitUntilAllConnectionsStartedFiringTxs waits until all of this
|
||||
// transacters connections have begun sending txs at the specified rate
|
||||
func (t *transacter) WaitUntilAllConnectionsStartedFiringTxs() {
|
||||
for {
|
||||
started := true
|
||||
for i := 0; i < t.Connections; i++ {
|
||||
if !t.connsStarted[i] && !t.connsBroken[i] {
|
||||
started = false
|
||||
}
|
||||
}
|
||||
if started {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Stop closes the connections.
|
||||
func (t *transacter) Stop() {
|
||||
t.stopped = true
|
||||
|
Reference in New Issue
Block a user