add cooldown
This commit is contained in:
parent
c5054ae0c6
commit
4a288db164
@ -58,6 +58,16 @@ func (p *Provider) RoundTrip(ctx context.Context) {
|
|||||||
// used for actual round trip time (disregard retry time)
|
// used for actual round trip time (disregard retry time)
|
||||||
roundTripStartedAt := time.Now()
|
roundTripStartedAt := time.Now()
|
||||||
for {
|
for {
|
||||||
|
// sleep until we get a clear to send
|
||||||
|
for {
|
||||||
|
coolDown := time.Duration(p.config.SendTransactionCoolDown) - time.Since(p.txPool.LastSend)
|
||||||
|
if coolDown > 0 {
|
||||||
|
time.Sleep(coolDown)
|
||||||
|
} else {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
tx := p.createTx(nonce)
|
tx := p.createTx(nonce)
|
||||||
txHash = tx.Hash()
|
txHash = tx.Hash()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user