Browse Source

e2e: reduce load pressure (#6939)

pull/6947/head
Sam Kleinman 3 years ago
committed by GitHub
parent
commit
6909158933
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 2 deletions
  1. +16
    -2
      test/e2e/runner/load.go

+ 16
- 2
test/e2e/runner/load.go View File

@ -105,13 +105,27 @@ func loadGenerate(ctx context.Context, chTx chan<- types.Tx, size int64) {
case chTx <- tx:
// sleep for a bit before sending the
// next transaction.
waitTime := (50 * time.Millisecond) + time.Duration(rand.Int63n(int64(time.Second))) // nolint: gosec
timer.Reset(waitTime)
timer.Reset(loadGenerateWaitTime(size))
}
}
}
func loadGenerateWaitTime(size int64) time.Duration {
const (
min = int64(100 * time.Millisecond)
max = int64(time.Second)
)
var (
baseJitter = rand.Int63n(max-min+1) + min // nolint: gosec
sizeFactor = size * int64(time.Millisecond)
sizeJitter = rand.Int63n(sizeFactor-min+1) + min // nolint: gosec
)
return time.Duration(baseJitter + sizeJitter)
}
// loadProcess processes transactions
func loadProcess(ctx context.Context, testnet *e2e.Testnet, chTx <-chan types.Tx, chSuccess chan<- int) {
// Each worker gets its own client to each usable node, which


Loading…
Cancel
Save