feat(go): add 100k ingest hardening baseline
This commit is contained in:
18
go/vehicle-gateway/internal/loadsim/schedule.go
Normal file
18
go/vehicle-gateway/internal/loadsim/schedule.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package loadsim
|
||||
|
||||
func ConnectionBatches(total int, ratePerSecond int) []int {
|
||||
if total <= 0 || ratePerSecond <= 0 {
|
||||
return nil
|
||||
}
|
||||
batches := make([]int, 0, (total+ratePerSecond-1)/ratePerSecond)
|
||||
remaining := total
|
||||
for remaining > 0 {
|
||||
batch := ratePerSecond
|
||||
if remaining < batch {
|
||||
batch = remaining
|
||||
}
|
||||
batches = append(batches, batch)
|
||||
remaining -= batch
|
||||
}
|
||||
return batches
|
||||
}
|
||||
Reference in New Issue
Block a user