Implement some sort of rate limiting
This commit is contained in:
14
main.go
14
main.go
@@ -175,12 +175,16 @@ func main() {
|
||||
client.Enable()
|
||||
for {
|
||||
if client.Connected {
|
||||
err := client.Send(submit)
|
||||
if err != nil {
|
||||
log.Printf("Failed to send PDU: %v", err)
|
||||
}
|
||||
// err := client.Send(submit)
|
||||
// if err != nil {
|
||||
// log.Printf("Failed to send PDU: %v", err)
|
||||
// }
|
||||
go client.Send(submit)
|
||||
// if rand.Int() % 1000 == 0 {
|
||||
// client.SendLimit.Set(rand.Int() % 1000)
|
||||
// }
|
||||
}
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
time.Sleep(500 * time.Millisecond)
|
||||
}
|
||||
log.Println("Are we done")
|
||||
|
||||
|
Reference in New Issue
Block a user